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

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

Issue 7775008: Enable sync for the settings from the Extension Settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Review #3 Created 9 years, 3 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) 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/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 return false; 572 return false;
573 } 573 }
574 574
575 return true; 575 return true;
576 } 576 }
577 577
578 ExtensionService::ExtensionService(Profile* profile, 578 ExtensionService::ExtensionService(Profile* profile,
579 const CommandLine* command_line, 579 const CommandLine* command_line,
580 const FilePath& install_directory, 580 const FilePath& install_directory,
581 ExtensionPrefs* extension_prefs, 581 ExtensionPrefs* extension_prefs,
582 ExtensionSettings* extension_settings,
583 bool autoupdate_enabled, 582 bool autoupdate_enabled,
584 bool extensions_enabled) 583 bool extensions_enabled)
585 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 584 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
586 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 585 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
587 profile_(profile), 586 profile_(profile),
588 extension_prefs_(extension_prefs), 587 extension_prefs_(extension_prefs),
589 extension_settings_(extension_settings),
590 pending_extension_manager_(*ALLOW_THIS_IN_INITIALIZER_LIST(this)), 588 pending_extension_manager_(*ALLOW_THIS_IN_INITIALIZER_LIST(this)),
591 install_directory_(install_directory), 589 install_directory_(install_directory),
592 extensions_enabled_(extensions_enabled), 590 extensions_enabled_(extensions_enabled),
593 show_extensions_prompts_(true), 591 show_extensions_prompts_(true),
594 ready_(false), 592 ready_(false),
595 toolbar_model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 593 toolbar_model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
596 permissions_manager_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 594 permissions_manager_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
597 apps_promo_(profile->GetPrefs()), 595 apps_promo_(profile->GetPrefs()),
598 event_routers_initialized_(false) { 596 event_routers_initialized_(false) {
599 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 597 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 27 matching lines...) Expand all
627 extension_prefs, 625 extension_prefs,
628 profile->GetPrefs(), 626 profile->GetPrefs(),
629 profile, 627 profile,
630 update_frequency)); 628 update_frequency));
631 } 629 }
632 630
633 backend_ = 631 backend_ =
634 new ExtensionServiceBackend(weak_ptr_factory_.GetWeakPtr(), 632 new ExtensionServiceBackend(weak_ptr_factory_.GetWeakPtr(),
635 install_directory_); 633 install_directory_);
636 634
635 // Construct the settings on the UI thread, but all further interaction
636 // (including destruction) must be done on the FILE thread.
637 extension_settings_ =
638 new ExtensionSettings(
639 profile_->GetPath().AppendASCII(kSettingsDirectoryName));
640
637 if (extensions_enabled_) { 641 if (extensions_enabled_) {
638 ExternalExtensionProviderImpl::CreateExternalProviders( 642 ExternalExtensionProviderImpl::CreateExternalProviders(
639 this, profile_, &external_extension_providers_); 643 this, profile_, &external_extension_providers_);
640 } 644 }
641 645
642 // Use monochrome icons for Omnibox icons. 646 // Use monochrome icons for Omnibox icons.
643 omnibox_popup_icon_manager_.set_monochrome(true); 647 omnibox_popup_icon_manager_.set_monochrome(true);
644 omnibox_icon_manager_.set_monochrome(true); 648 omnibox_icon_manager_.set_monochrome(true);
645 omnibox_icon_manager_.set_padding(gfx::Insets(0, kOmniboxIconPaddingLeft, 649 omnibox_icon_manager_.set_padding(gfx::Insets(0, kOmniboxIconPaddingLeft,
646 0, kOmniboxIconPaddingRight)); 650 0, kOmniboxIconPaddingRight));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 ExtensionService::~ExtensionService() { 685 ExtensionService::~ExtensionService() {
682 // No need to unload extensions here because they are profile-scoped, and the 686 // No need to unload extensions here because they are profile-scoped, and the
683 // profile is in the process of being deleted. 687 // profile is in the process of being deleted.
684 688
685 ProviderCollection::const_iterator i; 689 ProviderCollection::const_iterator i;
686 for (i = external_extension_providers_.begin(); 690 for (i = external_extension_providers_.begin();
687 i != external_extension_providers_.end(); ++i) { 691 i != external_extension_providers_.end(); ++i) {
688 ExternalExtensionProviderInterface* provider = i->get(); 692 ExternalExtensionProviderInterface* provider = i->get();
689 provider->ServiceShutdown(); 693 provider->ServiceShutdown();
690 } 694 }
695
696 BrowserThread::DeleteSoon(
697 BrowserThread::FILE, FROM_HERE, extension_settings_);
691 } 698 }
692 699
693 void ExtensionService::InitEventRoutersAfterImport() { 700 void ExtensionService::InitEventRoutersAfterImport() {
694 registrar_.Add(this, chrome::NOTIFICATION_IMPORT_FINISHED, 701 registrar_.Add(this, chrome::NOTIFICATION_IMPORT_FINISHED,
695 Source<Profile>(profile_)); 702 Source<Profile>(profile_));
696 } 703 }
697 704
698 void ExtensionService::InitEventRouters() { 705 void ExtensionService::InitEventRouters() {
699 if (event_routers_initialized_) 706 if (event_routers_initialized_)
700 return; 707 return;
(...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2871 2878
2872 ExtensionService::NaClModuleInfoList::iterator 2879 ExtensionService::NaClModuleInfoList::iterator
2873 ExtensionService::FindNaClModule(const GURL& url) { 2880 ExtensionService::FindNaClModule(const GURL& url) {
2874 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2881 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2875 iter != nacl_module_list_.end(); ++iter) { 2882 iter != nacl_module_list_.end(); ++iter) {
2876 if (iter->url == url) 2883 if (iter->url == url)
2877 return iter; 2884 return iter;
2878 } 2885 }
2879 return nacl_module_list_.end(); 2886 return nacl_module_list_.end();
2880 } 2887 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698