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

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: ready for review 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
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" 27 #include "extensions/browser/content_verifier.h"
28 #include "extensions/browser/content_verifier_delegate.h"
28 #include "extensions/browser/extension_function_histogram_value.h" 29 #include "extensions/browser/extension_function_histogram_value.h"
29 #include "extensions/browser/extension_prefs.h" 30 #include "extensions/browser/extension_prefs.h"
30 #include "extensions/browser/external_provider_interface.h" 31 #include "extensions/browser/external_provider_interface.h"
31 #include "extensions/browser/management_policy.h" 32 #include "extensions/browser/management_policy.h"
32 #include "extensions/browser/process_manager.h" 33 #include "extensions/browser/process_manager.h"
33 #include "extensions/common/extension.h" 34 #include "extensions/common/extension.h"
34 #include "extensions/common/extension_set.h" 35 #include "extensions/common/extension_set.h"
35 #include "extensions/common/manifest.h" 36 #include "extensions/common/manifest.h"
36 #include "extensions/common/one_shot_event.h" 37 #include "extensions/common/one_shot_event.h"
37 38
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0; 122 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0;
122 }; 123 };
123 124
124 // Manages installed and running Chromium extensions. An instance is shared 125 // Manages installed and running Chromium extensions. An instance is shared
125 // between normal and incognito profiles. 126 // between normal and incognito profiles.
126 class ExtensionService 127 class ExtensionService
127 : public ExtensionServiceInterface, 128 : public ExtensionServiceInterface,
128 public extensions::ExternalProviderInterface::VisitorInterface, 129 public extensions::ExternalProviderInterface::VisitorInterface,
129 public content::NotificationObserver, 130 public content::NotificationObserver,
130 public extensions::Blacklist::Observer, 131 public extensions::Blacklist::Observer,
131 public extensions::ContentVerifierObserver { 132 public extensions::ContentVerifierDelegate {
Ken Rockot(use gerrit already) 2014/05/09 23:51:16 If I could have one wish, just one wish, it would
asargent_no_longer_on_chrome 2014/05/10 00:12:43 =) Funny story: I originally didn't have Extensio
132 public: 133 public:
133 // Attempts to uninstall an extension from a given ExtensionService. Returns 134 // Attempts to uninstall an extension from a given ExtensionService. Returns
134 // true iff the target extension exists. 135 // true iff the target extension exists.
135 static bool UninstallExtensionHelper(ExtensionService* extensions_service, 136 static bool UninstallExtensionHelper(ExtensionService* extensions_service,
136 const std::string& extension_id); 137 const std::string& extension_id);
137 138
138 // Constructor stores pointers to |profile| and |extension_prefs| but 139 // Constructor stores pointers to |profile| and |extension_prefs| but
139 // ownership remains at caller. 140 // ownership remains at caller.
140 ExtensionService(Profile* profile, 141 ExtensionService(Profile* profile,
141 const base::CommandLine* command_line, 142 const base::CommandLine* command_line,
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 install_updates_when_idle_ = value; 467 install_updates_when_idle_ = value;
467 } 468 }
468 469
469 // Set a callback to be called when all external providers are ready and their 470 // Set a callback to be called when all external providers are ready and their
470 // extensions have been installed. 471 // extensions have been installed.
471 void set_external_updates_finished_callback_for_test( 472 void set_external_updates_finished_callback_for_test(
472 const base::Closure& callback) { 473 const base::Closure& callback) {
473 external_updates_finished_callback_ = callback; 474 external_updates_finished_callback_ = callback;
474 } 475 }
475 476
476 // ContentVerifierObserver implementation. 477 // ContentVerifierDelegate implementation.
477 virtual void ContentVerifyFailed(const std::string& extension_id) OVERRIDE; 478 virtual bool ShouldBeVerified(
479 const extensions::Extension& extension) OVERRIDE;
480 virtual const extensions::ContentVerifierKey& PublicKey() OVERRIDE;
481 virtual GURL GetSignatureFetchUrl(const std::string& extension_id,
482 const base::Version& version) OVERRIDE;
483 virtual void VerifyFailed(const std::string& extension_id) OVERRIDE;
478 484
479 // Adds/Removes update observers. 485 // Adds/Removes update observers.
480 void AddUpdateObserver(extensions::UpdateObserver* observer); 486 void AddUpdateObserver(extensions::UpdateObserver* observer);
481 void RemoveUpdateObserver(extensions::UpdateObserver* observer); 487 void RemoveUpdateObserver(extensions::UpdateObserver* observer);
482 488
483 private: 489 private:
484 // Populates greylist_. 490 // Populates greylist_.
485 void LoadGreylistFromPrefs(); 491 void LoadGreylistFromPrefs();
486 492
487 // Signals *ready_ and sends a notification to the listeners. 493 // Signals *ready_ and sends a notification to the listeners.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 718 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
713 GreylistedExtensionDisabled); 719 GreylistedExtensionDisabled);
714 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 720 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
715 GreylistDontEnableManuallyDisabled); 721 GreylistDontEnableManuallyDisabled);
716 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 722 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
717 GreylistUnknownDontChange); 723 GreylistUnknownDontChange);
718 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 724 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
719 }; 725 };
720 726
721 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 727 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | extensions/browser/content_verify_job.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698