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

Side by Side Diff: chrome/browser/extensions/extension_service.h

Issue 280013003: More implementation details of extension content verification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged latest trunk Created 6 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/prefs/pref_change_registrar.h" 19 #include "base/prefs/pref_change_registrar.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "chrome/browser/extensions/blacklist.h" 21 #include "chrome/browser/extensions/blacklist.h"
22 #include "chrome/browser/extensions/extension_sync_service.h" 22 #include "chrome/browser/extensions/extension_sync_service.h"
23 #include "chrome/browser/extensions/pending_extension_manager.h" 23 #include "chrome/browser/extensions/pending_extension_manager.h"
24 #include "content/public/browser/devtools_agent_host.h" 24 #include "content/public/browser/devtools_agent_host.h"
25 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
27 #include "extensions/browser/content_verifier.h"
28 #include "extensions/browser/extension_function_histogram_value.h" 27 #include "extensions/browser/extension_function_histogram_value.h"
29 #include "extensions/browser/extension_prefs.h" 28 #include "extensions/browser/extension_prefs.h"
30 #include "extensions/browser/external_provider_interface.h" 29 #include "extensions/browser/external_provider_interface.h"
31 #include "extensions/browser/management_policy.h" 30 #include "extensions/browser/management_policy.h"
32 #include "extensions/browser/process_manager.h" 31 #include "extensions/browser/process_manager.h"
33 #include "extensions/common/extension.h" 32 #include "extensions/common/extension.h"
34 #include "extensions/common/extension_set.h" 33 #include "extensions/common/extension_set.h"
35 #include "extensions/common/manifest.h" 34 #include "extensions/common/manifest.h"
36 #include "extensions/common/one_shot_event.h" 35 #include "extensions/common/one_shot_event.h"
37 36
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Returns task runner for crx installation file I/O operations. 119 // Returns task runner for crx installation file I/O operations.
121 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0; 120 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0;
122 }; 121 };
123 122
124 // Manages installed and running Chromium extensions. An instance is shared 123 // Manages installed and running Chromium extensions. An instance is shared
125 // between normal and incognito profiles. 124 // between normal and incognito profiles.
126 class ExtensionService 125 class ExtensionService
127 : public ExtensionServiceInterface, 126 : public ExtensionServiceInterface,
128 public extensions::ExternalProviderInterface::VisitorInterface, 127 public extensions::ExternalProviderInterface::VisitorInterface,
129 public content::NotificationObserver, 128 public content::NotificationObserver,
130 public extensions::Blacklist::Observer, 129 public extensions::Blacklist::Observer {
131 public extensions::ContentVerifierObserver {
132 public: 130 public:
133 // Attempts to uninstall an extension from a given ExtensionService. Returns 131 // Attempts to uninstall an extension from a given ExtensionService. Returns
134 // true iff the target extension exists. 132 // true iff the target extension exists.
135 static bool UninstallExtensionHelper(ExtensionService* extensions_service, 133 static bool UninstallExtensionHelper(ExtensionService* extensions_service,
136 const std::string& extension_id); 134 const std::string& extension_id);
137 135
138 // Constructor stores pointers to |profile| and |extension_prefs| but 136 // Constructor stores pointers to |profile| and |extension_prefs| but
139 // ownership remains at caller. 137 // ownership remains at caller.
140 ExtensionService(Profile* profile, 138 ExtensionService(Profile* profile,
141 const base::CommandLine* command_line, 139 const base::CommandLine* command_line,
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 install_updates_when_idle_ = value; 464 install_updates_when_idle_ = value;
467 } 465 }
468 466
469 // Set a callback to be called when all external providers are ready and their 467 // Set a callback to be called when all external providers are ready and their
470 // extensions have been installed. 468 // extensions have been installed.
471 void set_external_updates_finished_callback_for_test( 469 void set_external_updates_finished_callback_for_test(
472 const base::Closure& callback) { 470 const base::Closure& callback) {
473 external_updates_finished_callback_ = callback; 471 external_updates_finished_callback_ = callback;
474 } 472 }
475 473
476 // ContentVerifierObserver implementation.
477 virtual void ContentVerifyFailed(const std::string& extension_id) OVERRIDE;
478
479 // Adds/Removes update observers. 474 // Adds/Removes update observers.
480 void AddUpdateObserver(extensions::UpdateObserver* observer); 475 void AddUpdateObserver(extensions::UpdateObserver* observer);
481 void RemoveUpdateObserver(extensions::UpdateObserver* observer); 476 void RemoveUpdateObserver(extensions::UpdateObserver* observer);
482 477
483 private: 478 private:
484 // Populates greylist_. 479 // Populates greylist_.
485 void LoadGreylistFromPrefs(); 480 void LoadGreylistFromPrefs();
486 481
487 // Signals *ready_ and sends a notification to the listeners. 482 // Signals *ready_ and sends a notification to the listeners.
488 void SetReadyAndNotifyListeners(); 483 void SetReadyAndNotifyListeners();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 707 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
713 GreylistedExtensionDisabled); 708 GreylistedExtensionDisabled);
714 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 709 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
715 GreylistDontEnableManuallyDisabled); 710 GreylistDontEnableManuallyDisabled);
716 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 711 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
717 GreylistUnknownDontChange); 712 GreylistUnknownDontChange);
718 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 713 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
719 }; 714 };
720 715
721 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 716 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698