{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/stetho/pulls/comments/25215018","id":25215018,"diff_hunk":"@@ -0,0 +1,86 @@\n+package com.facebook.stetho.inspector.domstorage;\n+\n+import android.content.Context;\n+import android.content.SharedPreferences;\n+import com.facebook.stetho.inspector.helper.ChromePeerManager;\n+import com.facebook.stetho.inspector.helper.PeerRegistrationListener;\n+import com.facebook.stetho.inspector.helper.PeersRegisteredListener;\n+import com.facebook.stetho.inspector.protocol.module.DOMStorage;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+import java.util.Map;\n+\n+public class DOMStoragePeerManager extends ChromePeerManager {\n+  private final Context mContext;\n+\n+  public DOMStoragePeerManager(Context context) {\n+    mContext = context;\n+    setListener(mPeerListener);\n+  }\n+\n+  private final PeerRegistrationListener mPeerListener = new PeersRegisteredListener() {\n+    private final List<DevToolsSharedPreferencesListener> mPrefsListeners =\n+        new ArrayList<DevToolsSharedPreferencesListener>();\n+\n+    @Override\n+    protected synchronized void onFirstPeerRegistered() {\n+      // TODO: We list the tags in Page.getResourceTree as well and those are the real fixed\n+      // tags that will be observed by the peer.  We can fix this by making the page frames\n+      // dynamically update in response to DOMStorage events.  This would also allow us to\n+      // add new SharedPreferences tags as we observe them being created by way of\n+      // android.os.FileObserver.\n+      List<String> tags = SharedPreferencesHelper.getSharedPreferenceTags(mContext);\n+      for (String tag : tags) {\n+        SharedPreferences prefs = mContext.getSharedPreferences(tag, 0 /* mode */);\n+        DevToolsSharedPreferencesListener listener =\n+            new DevToolsSharedPreferencesListener(prefs, tag);\n+        prefs.registerOnSharedPreferenceChangeListener(listener);\n+        mPrefsListeners.add(listener);\n+      }\n+    }\n+\n+    @Override\n+    protected synchronized void onLastPeerUnregistered() {\n+      for (DevToolsSharedPreferencesListener prefsListener : mPrefsListeners) {\n+        prefsListener.unregister();\n+      }\n+    }","path":"stetho/src/main/java/com/facebook/stetho/inspector/domstorage/DOMStoragePeerManager.java","position":48,"original_position":48,"commit_id":"3ce773e873c09df3416f927692ad0e2ed3fc085c","original_commit_id":"3ce773e873c09df3416f927692ad0e2ed3fc085c","user":{"login":"jasta","id":83791,"avatar_url":"https://avatars.githubusercontent.com/u/83791?v=3","gravatar_id":"","url":"https://api.github.com/users/jasta","html_url":"https://github.com/jasta","followers_url":"https://api.github.com/users/jasta/followers","following_url":"https://api.github.com/users/jasta/following{/other_user}","gists_url":"https://api.github.com/users/jasta/gists{/gist_id}","starred_url":"https://api.github.com/users/jasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasta/subscriptions","organizations_url":"https://api.github.com/users/jasta/orgs","repos_url":"https://api.github.com/users/jasta/repos","events_url":"https://api.github.com/users/jasta/events{/privacy}","received_events_url":"https://api.github.com/users/jasta/received_events","type":"User","site_admin":false},"body":"Oops :)","created_at":"2015-02-23T23:44:11Z","updated_at":"2015-02-23T23:44:11Z","html_url":"https://github.com/facebook/stetho/pull/64#discussion_r25215018","pull_request_url":"https://api.github.com/repos/facebook/stetho/pulls/64","_links":{"self":{"href":"https://api.github.com/repos/facebook/stetho/pulls/comments/25215018"},"html":{"href":"https://github.com/facebook/stetho/pull/64#discussion_r25215018"},"pull_request":{"href":"https://api.github.com/repos/facebook/stetho/pulls/64"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/stetho/pulls/64","id":29766138,"html_url":"https://github.com/facebook/stetho/pull/64","diff_url":"https://github.com/facebook/stetho/pull/64.diff","patch_url":"https://github.com/facebook/stetho/pull/64.patch","issue_url":"https://api.github.com/repos/facebook/stetho/issues/64","number":64,"state":"open","locked":false,"title":"Add SharedPreferences data to Resources tab","user":{"login":"jasta","id":83791,"avatar_url":"https://avatars.githubusercontent.com/u/83791?v=3","gravatar_id":"","url":"https://api.github.com/users/jasta","html_url":"https://github.com/jasta","followers_url":"https://api.github.com/users/jasta/followers","following_url":"https://api.github.com/users/jasta/following{/other_user}","gists_url":"https://api.github.com/users/jasta/gists{/gist_id}","starred_url":"https://api.github.com/users/jasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasta/subscriptions","organizations_url":"https://api.github.com/users/jasta/orgs","repos_url":"https://api.github.com/users/jasta/repos","events_url":"https://api.github.com/users/jasta/events{/privacy}","received_events_url":"https://api.github.com/users/jasta/received_events","type":"User","site_admin":false},"body":"![inspector-sharedprefs](https://cloud.githubusercontent.com/assets/83791/6317606/79c49178-ba12-11e4-9f34-0abc51b8b8d2.png)\r\n\r\nCloses #50 ","created_at":"2015-02-22T05:40:37Z","updated_at":"2015-02-23T23:44:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6a73a4f6028267206a20a7fd157b3ebf81dcb0bb","assignee":{"login":"longinoa","id":3724320,"avatar_url":"https://avatars.githubusercontent.com/u/3724320?v=3","gravatar_id":"","url":"https://api.github.com/users/longinoa","html_url":"https://github.com/longinoa","followers_url":"https://api.github.com/users/longinoa/followers","following_url":"https://api.github.com/users/longinoa/following{/other_user}","gists_url":"https://api.github.com/users/longinoa/gists{/gist_id}","starred_url":"https://api.github.com/users/longinoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/longinoa/subscriptions","organizations_url":"https://api.github.com/users/longinoa/orgs","repos_url":"https://api.github.com/users/longinoa/repos","events_url":"https://api.github.com/users/longinoa/events{/privacy}","received_events_url":"https://api.github.com/users/longinoa/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/facebook/stetho/pulls/64/commits","review_comments_url":"https://api.github.com/repos/facebook/stetho/pulls/64/comments","review_comment_url":"https://api.github.com/repos/facebook/stetho/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/stetho/issues/64/comments","statuses_url":"https://api.github.com/repos/facebook/stetho/statuses/3ce773e873c09df3416f927692ad0e2ed3fc085c","head":{"label":"jasta:inspect-sharedprefs","ref":"inspect-sharedprefs","sha":"3ce773e873c09df3416f927692ad0e2ed3fc085c","user":{"login":"jasta","id":83791,"avatar_url":"https://avatars.githubusercontent.com/u/83791?v=3","gravatar_id":"","url":"https://api.github.com/users/jasta","html_url":"https://github.com/jasta","followers_url":"https://api.github.com/users/jasta/followers","following_url":"https://api.github.com/users/jasta/following{/other_user}","gists_url":"https://api.github.com/users/jasta/gists{/gist_id}","starred_url":"https://api.github.com/users/jasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasta/subscriptions","organizations_url":"https://api.github.com/users/jasta/orgs","repos_url":"https://api.github.com/users/jasta/repos","events_url":"https://api.github.com/users/jasta/events{/privacy}","received_events_url":"https://api.github.com/users/jasta/received_events","type":"User","site_admin":false},"repo":{"id":30987450,"name":"stetho","full_name":"jasta/stetho","owner":{"login":"jasta","id":83791,"avatar_url":"https://avatars.githubusercontent.com/u/83791?v=3","gravatar_id":"","url":"https://api.github.com/users/jasta","html_url":"https://github.com/jasta","followers_url":"https://api.github.com/users/jasta/followers","following_url":"https://api.github.com/users/jasta/following{/other_user}","gists_url":"https://api.github.com/users/jasta/gists{/gist_id}","starred_url":"https://api.github.com/users/jasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasta/subscriptions","organizations_url":"https://api.github.com/users/jasta/orgs","repos_url":"https://api.github.com/users/jasta/repos","events_url":"https://api.github.com/users/jasta/events{/privacy}","received_events_url":"https://api.github.com/users/jasta/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jasta/stetho","description":"Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.","fork":true,"url":"https://api.github.com/repos/jasta/stetho","forks_url":"https://api.github.com/repos/jasta/stetho/forks","keys_url":"https://api.github.com/repos/jasta/stetho/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jasta/stetho/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jasta/stetho/teams","hooks_url":"https://api.github.com/repos/jasta/stetho/hooks","issue_events_url":"https://api.github.com/repos/jasta/stetho/issues/events{/number}","events_url":"https://api.github.com/repos/jasta/stetho/events","assignees_url":"https://api.github.com/repos/jasta/stetho/assignees{/user}","branches_url":"https://api.github.com/repos/jasta/stetho/branches{/branch}","tags_url":"https://api.github.com/repos/jasta/stetho/tags","blobs_url":"https://api.github.com/repos/jasta/stetho/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jasta/stetho/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jasta/stetho/git/refs{/sha}","trees_url":"https://api.github.com/repos/jasta/stetho/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jasta/stetho/statuses/{sha}","languages_url":"https://api.github.com/repos/jasta/stetho/languages","stargazers_url":"https://api.github.com/repos/jasta/stetho/stargazers","contributors_url":"https://api.github.com/repos/jasta/stetho/contributors","subscribers_url":"https://api.github.com/repos/jasta/stetho/subscribers","subscription_url":"https://api.github.com/repos/jasta/stetho/subscription","commits_url":"https://api.github.com/repos/jasta/stetho/commits{/sha}","git_commits_url":"https://api.github.com/repos/jasta/stetho/git/commits{/sha}","comments_url":"https://api.github.com/repos/jasta/stetho/comments{/number}","issue_comment_url":"https://api.github.com/repos/jasta/stetho/issues/comments{/number}","contents_url":"https://api.github.com/repos/jasta/stetho/contents/{+path}","compare_url":"https://api.github.com/repos/jasta/stetho/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jasta/stetho/merges","archive_url":"https://api.github.com/repos/jasta/stetho/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jasta/stetho/downloads","issues_url":"https://api.github.com/repos/jasta/stetho/issues{/number}","pulls_url":"https://api.github.com/repos/jasta/stetho/pulls{/number}","milestones_url":"https://api.github.com/repos/jasta/stetho/milestones{/number}","notifications_url":"https://api.github.com/repos/jasta/stetho/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jasta/stetho/labels{/name}","releases_url":"https://api.github.com/repos/jasta/stetho/releases{/id}","created_at":"2015-02-18T21:17:34Z","updated_at":"2015-02-18T21:17:35Z","pushed_at":"2015-02-23T23:41:37Z","git_url":"git://github.com/jasta/stetho.git","ssh_url":"git@github.com:jasta/stetho.git","clone_url":"https://github.com/jasta/stetho.git","svn_url":"https://github.com/jasta/stetho","homepage":"http://facebook.github.io/stetho/","size":696,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"d5c603661757b444e90eafd556229a8ba339fa55","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":29703871,"name":"stetho","full_name":"facebook/stetho","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/stetho","description":"Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.","fork":false,"url":"https://api.github.com/repos/facebook/stetho","forks_url":"https://api.github.com/repos/facebook/stetho/forks","keys_url":"https://api.github.com/repos/facebook/stetho/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/stetho/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/stetho/teams","hooks_url":"https://api.github.com/repos/facebook/stetho/hooks","issue_events_url":"https://api.github.com/repos/facebook/stetho/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/stetho/events","assignees_url":"https://api.github.com/repos/facebook/stetho/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/stetho/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/stetho/tags","blobs_url":"https://api.github.com/repos/facebook/stetho/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/stetho/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/stetho/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/stetho/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/stetho/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/stetho/languages","stargazers_url":"https://api.github.com/repos/facebook/stetho/stargazers","contributors_url":"https://api.github.com/repos/facebook/stetho/contributors","subscribers_url":"https://api.github.com/repos/facebook/stetho/subscribers","subscription_url":"https://api.github.com/repos/facebook/stetho/subscription","commits_url":"https://api.github.com/repos/facebook/stetho/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/stetho/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/stetho/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/stetho/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/stetho/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/stetho/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/stetho/merges","archive_url":"https://api.github.com/repos/facebook/stetho/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/stetho/downloads","issues_url":"https://api.github.com/repos/facebook/stetho/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/stetho/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/stetho/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/stetho/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/stetho/labels{/name}","releases_url":"https://api.github.com/repos/facebook/stetho/releases{/id}","created_at":"2015-01-22T22:34:10Z","updated_at":"2015-02-23T23:26:46Z","pushed_at":"2015-02-23T23:26:45Z","git_url":"git://github.com/facebook/stetho.git","ssh_url":"git@github.com:facebook/stetho.git","clone_url":"https://github.com/facebook/stetho.git","svn_url":"https://github.com/facebook/stetho","homepage":"http://facebook.github.io/stetho/","size":1219,"stargazers_count":1360,"watchers_count":1360,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":67,"mirror_url":null,"open_issues_count":14,"forks":67,"open_issues":14,"watchers":1360,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/stetho/pulls/64"},"html":{"href":"https://github.com/facebook/stetho/pull/64"},"issue":{"href":"https://api.github.com/repos/facebook/stetho/issues/64"},"comments":{"href":"https://api.github.com/repos/facebook/stetho/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/stetho/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/stetho/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/stetho/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/stetho/statuses/3ce773e873c09df3416f927692ad0e2ed3fc085c"}}}}