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

Side by Side Diff: chrome/browser/extensions/extensions_service.cc

Issue 412007: Add extensions BookmarkModel observer automatically when manifest has bookmarks permission. (Closed)
Patch Set: remove extraneous event_router->Observe 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/browser/extensions/extension_bookmarks_module.cc ('k') | no next file » | 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 #include "chrome/browser/extensions/extensions_service.h" 5 #include "chrome/browser/extensions/extensions_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_thread.h" 14 #include "chrome/browser/chrome_thread.h"
15 #include "chrome/browser/debugger/devtools_manager.h" 15 #include "chrome/browser/debugger/devtools_manager.h"
16 #include "chrome/browser/extensions/crx_installer.h" 16 #include "chrome/browser/extensions/crx_installer.h"
17 #include "chrome/browser/extensions/extension_bookmarks_module.h"
17 #include "chrome/browser/extensions/extension_browser_event_router.h" 18 #include "chrome/browser/extensions/extension_browser_event_router.h"
18 #include "chrome/browser/extensions/extension_dom_ui.h" 19 #include "chrome/browser/extensions/extension_dom_ui.h"
19 #include "chrome/browser/extensions/extension_file_util.h" 20 #include "chrome/browser/extensions/extension_file_util.h"
20 #include "chrome/browser/extensions/extension_history_api.h" 21 #include "chrome/browser/extensions/extension_history_api.h"
21 #include "chrome/browser/extensions/extension_process_manager.h" 22 #include "chrome/browser/extensions/extension_process_manager.h"
22 #include "chrome/browser/extensions/extension_updater.h" 23 #include "chrome/browser/extensions/extension_updater.h"
23 #include "chrome/browser/extensions/external_extension_provider.h" 24 #include "chrome/browser/extensions/external_extension_provider.h"
24 #include "chrome/browser/extensions/external_pref_extension_provider.h" 25 #include "chrome/browser/extensions/external_pref_extension_provider.h"
25 #include "chrome/browser/profile.h" 26 #include "chrome/browser/profile.h"
26 #include "chrome/browser/net/chrome_url_request_context.h" 27 #include "chrome/browser/net/chrome_url_request_context.h"
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 578
578 switch (extension_prefs_->GetExtensionState(extension->id())) { 579 switch (extension_prefs_->GetExtensionState(extension->id())) {
579 case Extension::ENABLED: 580 case Extension::ENABLED:
580 extensions_.push_back(scoped_extension.release()); 581 extensions_.push_back(scoped_extension.release());
581 582
582 // We delay starting up the browser event router until at least one 583 // We delay starting up the browser event router until at least one
583 // extension that needs it is loaded. 584 // extension that needs it is loaded.
584 if (extension->HasApiPermission(Extension::kTabPermission)) { 585 if (extension->HasApiPermission(Extension::kTabPermission)) {
585 ExtensionBrowserEventRouter::GetInstance()->Init(); 586 ExtensionBrowserEventRouter::GetInstance()->Init();
586 } 587 }
588 if (extension->HasApiPermission(Extension::kBookmarkPermission)) {
589 ExtensionBookmarkEventRouter::GetSingleton()->Observe(
590 profile_->GetBookmarkModel());
591 }
587 592
588 if (extension->location() != Extension::LOAD) 593 if (extension->location() != Extension::LOAD)
589 extension_prefs_->MigrateToPrefs(extension); 594 extension_prefs_->MigrateToPrefs(extension);
590 595
591 NotifyExtensionLoaded(extension); 596 NotifyExtensionLoaded(extension);
592 597
593 if (extension->IsTheme() && extension->location() == Extension::LOAD) { 598 if (extension->IsTheme() && extension->location() == Extension::LOAD) {
594 NotificationService::current()->Notify( 599 NotificationService::current()->Notify(
595 NotificationType::THEME_INSTALLED, 600 NotificationType::THEME_INSTALLED,
596 Source<Profile>(profile_), 601 Source<Profile>(profile_),
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 956
952 void ExtensionsServiceBackend::OnExternalExtensionFound( 957 void ExtensionsServiceBackend::OnExternalExtensionFound(
953 const std::string& id, const Version* version, const FilePath& path, 958 const std::string& id, const Version* version, const FilePath& path,
954 Extension::Location location) { 959 Extension::Location location) {
955 ChromeThread::PostTask( 960 ChromeThread::PostTask(
956 ChromeThread::UI, FROM_HERE, 961 ChromeThread::UI, FROM_HERE,
957 NewRunnableMethod( 962 NewRunnableMethod(
958 frontend_, &ExtensionsService::OnExternalExtensionFound, id, 963 frontend_, &ExtensionsService::OnExternalExtensionFound, id,
959 version->GetString(), path, location)); 964 version->GetString(), path, location));
960 } 965 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_bookmarks_module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698