Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: chrome/common/extensions/extension.h

Issue 337035: Replace ExtensionAction with ExtensionAction2. (Closed)
Patch Set: Remove todo Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "base/version.h" 16 #include "base/version.h"
17 #include "chrome/browser/extensions/user_script_master.h" 17 #include "chrome/browser/extensions/user_script_master.h"
18 #include "chrome/common/extensions/extension_action.h" 18 #include "chrome/common/extensions/extension_action.h"
19 #include "chrome/common/extensions/extension_action2.h"
20 #include "chrome/common/extensions/extension_message_bundle.h" 19 #include "chrome/common/extensions/extension_message_bundle.h"
21 #include "chrome/common/extensions/extension_resource.h" 20 #include "chrome/common/extensions/extension_resource.h"
22 #include "chrome/common/extensions/user_script.h" 21 #include "chrome/common/extensions/user_script.h"
23 #include "chrome/common/extensions/url_pattern.h" 22 #include "chrome/common/extensions/url_pattern.h"
24 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
25 24
26 // Represents a Chrome extension. 25 // Represents a Chrome extension.
27 class Extension { 26 class Extension {
28 public: 27 public:
29 typedef std::vector<URLPattern> HostPermissions; 28 typedef std::vector<URLPattern> HostPermissions;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 const Location location() const { return location_; } 183 const Location location() const { return location_; }
185 void set_location(Location location) { location_ = location; } 184 void set_location(Location location) { location_ = location; }
186 const std::string& id() const { return id_; } 185 const std::string& id() const { return id_; }
187 const Version* version() const { return version_.get(); } 186 const Version* version() const { return version_.get(); }
188 // String representation of the version number. 187 // String representation of the version number.
189 const std::string VersionString() const; 188 const std::string VersionString() const;
190 const std::string& name() const { return name_; } 189 const std::string& name() const { return name_; }
191 const std::string& public_key() const { return public_key_; } 190 const std::string& public_key() const { return public_key_; }
192 const std::string& description() const { return description_; } 191 const std::string& description() const { return description_; }
193 const UserScriptList& content_scripts() const { return content_scripts_; } 192 const UserScriptList& content_scripts() const { return content_scripts_; }
194 ExtensionAction2* page_action() const { return page_action_.get(); } 193 ExtensionAction* page_action() const { return page_action_.get(); }
195 ExtensionAction2* browser_action() const { return browser_action_.get(); } 194 ExtensionAction* browser_action() const { return browser_action_.get(); }
196 const std::vector<PrivacyBlacklistInfo>& privacy_blacklists() const { 195 const std::vector<PrivacyBlacklistInfo>& privacy_blacklists() const {
197 return privacy_blacklists_; 196 return privacy_blacklists_;
198 } 197 }
199 const std::vector<PluginInfo>& plugins() const { return plugins_; } 198 const std::vector<PluginInfo>& plugins() const { return plugins_; }
200 const GURL& background_url() const { return background_url_; } 199 const GURL& background_url() const { return background_url_; }
201 const GURL& options_url() const { return options_url_; } 200 const GURL& options_url() const { return options_url_; }
202 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; } 201 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; }
203 const std::vector<std::string>& api_permissions() const { 202 const std::vector<std::string>& api_permissions() const {
204 return api_permissions_; 203 return api_permissions_;
205 } 204 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 void SetBackgroundPageReady(); 271 void SetBackgroundPageReady();
273 272
274 private: 273 private:
275 // Helper method that loads a UserScript object from a 274 // Helper method that loads a UserScript object from a
276 // dictionary in the content_script list of the manifest. 275 // dictionary in the content_script list of the manifest.
277 bool LoadUserScriptHelper(const DictionaryValue* content_script, 276 bool LoadUserScriptHelper(const DictionaryValue* content_script,
278 int definition_index, 277 int definition_index,
279 std::string* error, 278 std::string* error,
280 UserScript* result); 279 UserScript* result);
281 280
282 // Helper method that loads a ExtensionAction object from a 281 // Helper method to load an ExtensionAction from the page_action or
283 // dictionary in the page_action or browser_action section of the manifest.
284 ExtensionAction2* LoadExtensionActionHelper(
285 const DictionaryValue* contextual_action,
286 std::string* error,
287 ExtensionAction::ExtensionActionType action_type);
288
289 // Helper method to load an ExtensionAction2 from the page_action or
290 // browser_action entries in the manifest. 282 // browser_action entries in the manifest.
291 // TODO(aa): ExtensionAction2 should replace ExtensionAction completely. 283 ExtensionAction* LoadExtensionActionHelper(
292 ExtensionAction2* LoadExtensionAction2Helper(
293 const DictionaryValue* extension_action, std::string* error); 284 const DictionaryValue* extension_action, std::string* error);
294 285
295 // Figures out if a source contains keys not associated with themes - we 286 // Figures out if a source contains keys not associated with themes - we
296 // don't want to allow scripts and such to be bundled with themes. 287 // don't want to allow scripts and such to be bundled with themes.
297 bool ContainsNonThemeKeys(const DictionaryValue& source); 288 bool ContainsNonThemeKeys(const DictionaryValue& source);
298 289
299 // The absolute path to the directory the extension is stored in. 290 // The absolute path to the directory the extension is stored in.
300 FilePath path_; 291 FilePath path_;
301 292
302 // The base extension url for the extension. 293 // The base extension url for the extension.
(...skipping 16 matching lines...) Expand all
319 // The extension's human-readable name. 310 // The extension's human-readable name.
320 std::string name_; 311 std::string name_;
321 312
322 // An optional longer description of the extension. 313 // An optional longer description of the extension.
323 std::string description_; 314 std::string description_;
324 315
325 // Paths to the content scripts the extension contains. 316 // Paths to the content scripts the extension contains.
326 UserScriptList content_scripts_; 317 UserScriptList content_scripts_;
327 318
328 // The extension's page action, if any. 319 // The extension's page action, if any.
329 scoped_ptr<ExtensionAction2> page_action_; 320 scoped_ptr<ExtensionAction> page_action_;
330 321
331 // The extension's browser action, if any. 322 // The extension's browser action, if any.
332 scoped_ptr<ExtensionAction2> browser_action_; 323 scoped_ptr<ExtensionAction> browser_action_;
333 324
334 // Optional list of privacy blacklistrom. 325 // Optional list of privacy blacklistrom.
335 std::vector<PrivacyBlacklistInfo> privacy_blacklists_; 326 std::vector<PrivacyBlacklistInfo> privacy_blacklists_;
336 327
337 // Optional list of NPAPI plugins and associated properties. 328 // Optional list of NPAPI plugins and associated properties.
338 std::vector<PluginInfo> plugins_; 329 std::vector<PluginInfo> plugins_;
339 330
340 // Optional URL to a master page of which a single instance should be always 331 // Optional URL to a master page of which a single instance should be always
341 // loaded in the background. 332 // loaded in the background.
342 GURL background_url_; 333 GURL background_url_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 383
393 // True if the background page is ready. 384 // True if the background page is ready.
394 bool background_page_ready_; 385 bool background_page_ready_;
395 386
396 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); 387 FRIEND_TEST(ExtensionTest, LoadPageActionHelper);
397 388
398 DISALLOW_COPY_AND_ASSIGN(Extension); 389 DISALLOW_COPY_AND_ASSIGN(Extension);
399 }; 390 };
400 391
401 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 392 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698