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

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 #2 against correct branch 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 omnibox_popup_icon_manager_.set_monochrome(true); 643 omnibox_popup_icon_manager_.set_monochrome(true);
644 omnibox_icon_manager_.set_monochrome(true); 644 omnibox_icon_manager_.set_monochrome(true);
645 omnibox_icon_manager_.set_padding(gfx::Insets(0, kOmniboxIconPaddingLeft, 645 omnibox_icon_manager_.set_padding(gfx::Insets(0, kOmniboxIconPaddingLeft,
646 0, kOmniboxIconPaddingRight)); 646 0, kOmniboxIconPaddingRight));
647 647
648 // How long is the path to the Extensions directory? 648 // How long is the path to the Extensions directory?
649 UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions.ExtensionRootPathLength", 649 UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions.ExtensionRootPathLength",
650 install_directory_.value().length(), 0, 500, 100); 650 install_directory_.value().length(), 0, 500, 100);
651 } 651 }
652 652
653 static void AddAllExtensionIds(
Ben Olmstead 2011/09/16 18:21:43 Wrap in anonymous namespace.
not at google - send to devlin 2011/09/19 07:10:47 No longer needed.
654 std::vector<std::string>* dst, const ExtensionList& src) {
akalin 2011/09/17 08:44:47 i think output args are usually put last
not at google - send to devlin 2011/09/19 07:10:47 No longer needed.
655 for (ExtensionList::const_iterator it = src.begin(); it != src.end(); ++it) {
656 dst->push_back((*it)->id());
657 }
658 }
659
660 const std::vector<std::string> ExtensionService::GetAllExtensionIds() const {
661 std::vector<std::string> all_extension_ids;
662 AddAllExtensionIds(&all_extension_ids, extensions_);
663 AddAllExtensionIds(&all_extension_ids, disabled_extensions_);
664 AddAllExtensionIds(&all_extension_ids, terminated_extensions_);
665 return all_extension_ids;
666 }
667
653 const ExtensionList* ExtensionService::extensions() const { 668 const ExtensionList* ExtensionService::extensions() const {
654 return &extensions_; 669 return &extensions_;
655 } 670 }
656 671
657 const ExtensionList* ExtensionService::disabled_extensions() const { 672 const ExtensionList* ExtensionService::disabled_extensions() const {
658 return &disabled_extensions_; 673 return &disabled_extensions_;
659 } 674 }
660 675
661 const ExtensionList* ExtensionService::terminated_extensions() const { 676 const ExtensionList* ExtensionService::terminated_extensions() const {
662 return &terminated_extensions_; 677 return &terminated_extensions_;
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 sync_data_list->push_back( 1894 sync_data_list->push_back(
1880 ExtensionSyncData(extension, 1895 ExtensionSyncData(extension,
1881 IsExtensionEnabled(extension.id()), 1896 IsExtensionEnabled(extension.id()),
1882 IsIncognitoEnabled(extension.id()))); 1897 IsIncognitoEnabled(extension.id())));
1883 } 1898 }
1884 } 1899 }
1885 } 1900 }
1886 1901
1887 std::vector<ExtensionSyncData> ExtensionService::GetSyncDataList( 1902 std::vector<ExtensionSyncData> ExtensionService::GetSyncDataList(
1888 const SyncBundle& bundle) const { 1903 const SyncBundle& bundle) const {
1889 std::vector<ExtensionSyncData> extension_sync_list; 1904 std::vector<ExtensionSyncData> extension_sync_list;
akalin 2011/09/17 08:44:47 rewrite this fn using GetAllExtensionIds() and Get
1890 GetSyncDataListHelper(extensions_, bundle, &extension_sync_list); 1905 GetSyncDataListHelper(extensions_, bundle, &extension_sync_list);
1891 GetSyncDataListHelper(disabled_extensions_, bundle, &extension_sync_list); 1906 GetSyncDataListHelper(disabled_extensions_, bundle, &extension_sync_list);
1892 GetSyncDataListHelper(terminated_extensions_, bundle, &extension_sync_list); 1907 GetSyncDataListHelper(terminated_extensions_, bundle, &extension_sync_list);
1893 1908
1894 for (std::map<std::string, ExtensionSyncData>::const_iterator i = 1909 for (std::map<std::string, ExtensionSyncData>::const_iterator i =
1895 bundle.pending_sync_data.begin(); 1910 bundle.pending_sync_data.begin();
1896 i != bundle.pending_sync_data.end(); 1911 i != bundle.pending_sync_data.end();
1897 ++i) { 1912 ++i) {
1898 extension_sync_list.push_back(i->second); 1913 extension_sync_list.push_back(i->second);
1899 } 1914 }
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2871 2886
2872 ExtensionService::NaClModuleInfoList::iterator 2887 ExtensionService::NaClModuleInfoList::iterator
2873 ExtensionService::FindNaClModule(const GURL& url) { 2888 ExtensionService::FindNaClModule(const GURL& url) {
2874 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2889 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2875 iter != nacl_module_list_.end(); ++iter) { 2890 iter != nacl_module_list_.end(); ++iter) {
2876 if (iter->url == url) 2891 if (iter->url == url)
2877 return iter; 2892 return iter;
2878 } 2893 }
2879 return nacl_module_list_.end(); 2894 return nacl_module_list_.end();
2880 } 2895 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698