OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/activity_log/activity_log.h" | 5 #include "chrome/browser/extensions/activity_log/activity_log.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // IDs which are translated. | 85 // IDs which are translated. |
86 // | 86 // |
87 // If DICT_LOOKUP, the data is expected to be a dictionary, and | 87 // If DICT_LOOKUP, the data is expected to be a dictionary, and |
88 // arg_url_dict_path is a path (list of keys delimited by ".") where a URL | 88 // arg_url_dict_path is a path (list of keys delimited by ".") where a URL |
89 // string is to be found. | 89 // string is to be found. |
90 Transformation arg_url_transform; | 90 Transformation arg_url_transform; |
91 const char* arg_url_dict_path; | 91 const char* arg_url_dict_path; |
92 }; | 92 }; |
93 | 93 |
94 static const ApiInfo kApiInfoTable[] = { | 94 static const ApiInfo kApiInfoTable[] = { |
95 // Tabs APIs that require tab ID translation | 95 // Tabs APIs that require tab ID translation |
96 {Action::ACTION_API_CALL, "tabs.connect", 0, LOOKUP_TAB_ID, NULL}, | 96 {Action::ACTION_API_CALL, "tabs.connect", 0, LOOKUP_TAB_ID, NULL}, |
97 {Action::ACTION_API_CALL, "tabs.detectLanguage", 0, LOOKUP_TAB_ID, NULL}, | 97 {Action::ACTION_API_CALL, "tabs.detectLanguage", 0, LOOKUP_TAB_ID, NULL}, |
98 {Action::ACTION_API_CALL, "tabs.duplicate", 0, LOOKUP_TAB_ID, NULL}, | 98 {Action::ACTION_API_CALL, "tabs.duplicate", 0, LOOKUP_TAB_ID, NULL}, |
99 {Action::ACTION_API_CALL, "tabs.executeScript", 0, LOOKUP_TAB_ID, NULL}, | 99 {Action::ACTION_API_CALL, "tabs.executeScript", 0, LOOKUP_TAB_ID, NULL}, |
100 {Action::ACTION_API_CALL, "tabs.get", 0, LOOKUP_TAB_ID, NULL}, | 100 {Action::ACTION_API_CALL, "tabs.get", 0, LOOKUP_TAB_ID, NULL}, |
101 {Action::ACTION_API_CALL, "tabs.insertCSS", 0, LOOKUP_TAB_ID, NULL}, | 101 {Action::ACTION_API_CALL, "tabs.insertCSS", 0, LOOKUP_TAB_ID, NULL}, |
102 {Action::ACTION_API_CALL, "tabs.move", 0, LOOKUP_TAB_ID, NULL}, | 102 {Action::ACTION_API_CALL, "tabs.move", 0, LOOKUP_TAB_ID, NULL}, |
103 {Action::ACTION_API_CALL, "tabs.reload", 0, LOOKUP_TAB_ID, NULL}, | 103 {Action::ACTION_API_CALL, "tabs.reload", 0, LOOKUP_TAB_ID, NULL}, |
104 {Action::ACTION_API_CALL, "tabs.remove", 0, LOOKUP_TAB_ID, NULL}, | 104 {Action::ACTION_API_CALL, "tabs.remove", 0, LOOKUP_TAB_ID, NULL}, |
105 {Action::ACTION_API_CALL, "tabs.sendMessage", 0, LOOKUP_TAB_ID, NULL}, | 105 {Action::ACTION_API_CALL, "tabs.sendMessage", 0, LOOKUP_TAB_ID, NULL}, |
106 {Action::ACTION_API_CALL, "tabs.update", 0, LOOKUP_TAB_ID, NULL}, | 106 {Action::ACTION_API_CALL, "tabs.update", 0, LOOKUP_TAB_ID, NULL}, |
107 {Action::ACTION_API_EVENT, "tabs.onUpdated", 0, LOOKUP_TAB_ID, NULL}, | |
108 {Action::ACTION_API_EVENT, "tabs.onMoved", 0, LOOKUP_TAB_ID, NULL}, | |
109 {Action::ACTION_API_EVENT, "tabs.onDetached", 0, LOOKUP_TAB_ID, NULL}, | |
110 {Action::ACTION_API_EVENT, "tabs.onAttached", 0, LOOKUP_TAB_ID, NULL}, | |
111 {Action::ACTION_API_EVENT, "tabs.onRemoved", 0, LOOKUP_TAB_ID, NULL}, | |
112 {Action::ACTION_API_EVENT, "tabs.onReplaced", 0, LOOKUP_TAB_ID, NULL}, | |
107 | 113 |
108 {Action::ACTION_API_EVENT, "tabs.onUpdated", 0, LOOKUP_TAB_ID, NULL}, | 114 // Other APIs that accept URLs as strings |
109 {Action::ACTION_API_EVENT, "tabs.onMoved", 0, LOOKUP_TAB_ID, NULL}, | 115 {Action::ACTION_API_CALL, "bookmarks.create", 0, DICT_LOOKUP, "url"}, |
110 {Action::ACTION_API_EVENT, "tabs.onDetached", 0, LOOKUP_TAB_ID, NULL}, | 116 {Action::ACTION_API_CALL, "bookmarks.update", 1, DICT_LOOKUP, "url"}, |
111 {Action::ACTION_API_EVENT, "tabs.onAttached", 0, LOOKUP_TAB_ID, NULL}, | 117 {Action::ACTION_API_CALL, "cookies.get", 0, DICT_LOOKUP, "url"}, |
112 {Action::ACTION_API_EVENT, "tabs.onRemoved", 0, LOOKUP_TAB_ID, NULL}, | 118 {Action::ACTION_API_CALL, "cookies.getAll", 0, DICT_LOOKUP, "url"}, |
113 {Action::ACTION_API_EVENT, "tabs.onReplaced", 0, LOOKUP_TAB_ID, NULL}, | 119 {Action::ACTION_API_CALL, "cookies.remove", 0, DICT_LOOKUP, "url"}, |
114 | 120 {Action::ACTION_API_CALL, "cookies.set", 0, DICT_LOOKUP, "url"}, |
115 // Other APIs that accept URLs as strings | 121 {Action::ACTION_API_CALL, "downloads.download", 0, DICT_LOOKUP, "url"}, |
116 {Action::ACTION_API_CALL, "bookmarks.create", 0, DICT_LOOKUP, "url"}, | 122 {Action::ACTION_API_CALL, "history.addUrl", 0, DICT_LOOKUP, "url"}, |
117 {Action::ACTION_API_CALL, "bookmarks.update", 1, DICT_LOOKUP, "url"}, | 123 {Action::ACTION_API_CALL, "history.deleteUrl", 0, DICT_LOOKUP, "url"}, |
118 {Action::ACTION_API_CALL, "cookies.get", 0, DICT_LOOKUP, "url"}, | 124 {Action::ACTION_API_CALL, "history.getVisits", 0, DICT_LOOKUP, "url"}, |
119 {Action::ACTION_API_CALL, "cookies.getAll", 0, DICT_LOOKUP, "url"}, | 125 {Action::ACTION_API_CALL, "webstore.install", 0, NONE, NULL}, |
120 {Action::ACTION_API_CALL, "cookies.remove", 0, DICT_LOOKUP, "url"}, | 126 {Action::ACTION_API_CALL, "windows.create", 0, DICT_LOOKUP, "url"}, |
121 {Action::ACTION_API_CALL, "cookies.set", 0, DICT_LOOKUP, "url"}, | 127 {Action::ACTION_DOM_ACCESS, "Document.location", 0, NONE, NULL}, |
122 {Action::ACTION_API_CALL, "downloads.download", 0, DICT_LOOKUP, "url"}, | 128 {Action::ACTION_DOM_ACCESS, "Location.assign", 0, NONE, NULL}, |
123 {Action::ACTION_API_CALL, "history.addUrl", 0, DICT_LOOKUP, "url"}, | 129 {Action::ACTION_DOM_ACCESS, "Location.replace", 0, NONE, NULL}, |
124 {Action::ACTION_API_CALL, "history.deleteUrl", 0, DICT_LOOKUP, "url"}, | 130 {Action::ACTION_DOM_ACCESS, "Window.location", 0, NONE, NULL}, |
125 {Action::ACTION_API_CALL, "history.getVisits", 0, DICT_LOOKUP, "url"}, | 131 {Action::ACTION_DOM_ACCESS, "XMLHttpRequest.open", 1, NONE, NULL}, |
mvrable
2014/02/12 19:50:08
Could you keep the list sorted instead of adding y
pmarch
2014/02/12 20:29:53
Done.
| |
126 {Action::ACTION_API_CALL, "webstore.install", 0, NONE, NULL}, | 132 {Action::ACTION_DOM_ACCESS, "HTMLButtonElement.formAction", 0, NONE, NULL}, |
127 {Action::ACTION_API_CALL, "windows.create", 0, DICT_LOOKUP, "url"}, | 133 {Action::ACTION_DOM_ACCESS, "HTMLEmbedElement.src", 0, NONE, NULL}, |
128 | 134 {Action::ACTION_DOM_ACCESS, "HTMLFormElement.action", 0, NONE, NULL}, |
129 {Action::ACTION_DOM_ACCESS, "Document.location", 0, NONE, NULL}, | 135 {Action::ACTION_DOM_ACCESS, "HTMLFrameElement.src", 0, NONE, NULL}, |
130 {Action::ACTION_DOM_ACCESS, "Location.assign", 0, NONE, NULL}, | 136 {Action::ACTION_DOM_ACCESS, "HTMLHtmlElement.manifest", 0, NONE, NULL}, |
131 {Action::ACTION_DOM_ACCESS, "Location.replace", 0, NONE, NULL}, | 137 {Action::ACTION_DOM_ACCESS, "HTMLIFrameElement.src", 0, NONE, NULL}, |
132 {Action::ACTION_DOM_ACCESS, "Window.location", 0, NONE, NULL}, | 138 {Action::ACTION_DOM_ACCESS, "HTMLImageElement.longDesc", 0, NONE, NULL}, |
133 {Action::ACTION_DOM_ACCESS, "XMLHttpRequest.open", 1, NONE, NULL}, | 139 {Action::ACTION_DOM_ACCESS, "HTMLImageElement.src", 0, NONE, NULL}, |
134 }; | 140 {Action::ACTION_DOM_ACCESS, "HTMLImageElement.lowsrc", 0, NONE, NULL}, |
141 {Action::ACTION_DOM_ACCESS, "HTMLInputElement.formAction", 0, NONE, NULL}, | |
142 {Action::ACTION_DOM_ACCESS, "HTMLInputElement.src", 0, NONE, NULL}, | |
143 {Action::ACTION_DOM_ACCESS, "HTMLLinkElement.href", 0, NONE, NULL}, | |
144 {Action::ACTION_DOM_ACCESS, "HTMLMediaElement.src", 0, NONE, NULL}, | |
145 {Action::ACTION_DOM_ACCESS, "HTMLMediaElement.currentSrc", 0, NONE, NULL}, | |
146 {Action::ACTION_DOM_ACCESS, "HTMLModElement.cite", 0, NONE, NULL}, | |
147 {Action::ACTION_DOM_ACCESS, "HTMLObjectElement.data", 0, NONE, NULL}, | |
148 {Action::ACTION_DOM_ACCESS, "HTMLQuoteElement.cite", 0, NONE, NULL}, | |
149 {Action::ACTION_DOM_ACCESS, "HTMLScriptElement.src", 0, NONE, NULL}, | |
150 {Action::ACTION_DOM_ACCESS, "HTMLSourceElement.src", 0, NONE, NULL}, | |
151 {Action::ACTION_DOM_ACCESS, "HTMLTrackElement.src", 0, NONE, NULL}, | |
152 {Action::ACTION_DOM_ACCESS, "HTMLVideoElement.poster", 0, NONE, NULL}}; | |
135 | 153 |
136 // A singleton class which provides lookups into the kApiInfoTable data | 154 // A singleton class which provides lookups into the kApiInfoTable data |
137 // structure. It inserts all data into a map on first lookup. | 155 // structure. It inserts all data into a map on first lookup. |
138 class ApiInfoDatabase { | 156 class ApiInfoDatabase { |
139 public: | 157 public: |
140 static ApiInfoDatabase* GetInstance() { | 158 static ApiInfoDatabase* GetInstance() { |
141 return Singleton<ApiInfoDatabase>::get(); | 159 return Singleton<ApiInfoDatabase>::get(); |
142 } | 160 } |
143 | 161 |
144 // Retrieves an ApiInfo record for the given Action type. Returns either a | 162 // Retrieves an ApiInfo record for the given Action type. Returns either a |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 RemoveURLs(urls); | 704 RemoveURLs(urls); |
687 } | 705 } |
688 | 706 |
689 void ActivityLog::DeleteDatabase() { | 707 void ActivityLog::DeleteDatabase() { |
690 if (!database_policy_) | 708 if (!database_policy_) |
691 return; | 709 return; |
692 database_policy_->DeleteDatabase(); | 710 database_policy_->DeleteDatabase(); |
693 } | 711 } |
694 | 712 |
695 } // namespace extensions | 713 } // namespace extensions |
OLD | NEW |