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

Side by Side Diff: chrome/browser/themes/theme_service.cc

Issue 102103005: Move c/c/e/extension_set to top-level extensions/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years 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
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 #include "chrome/browser/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/extension_system.h" 16 #include "chrome/browser/extensions/extension_system.h"
17 #include "chrome/browser/managed_mode/managed_user_theme.h" 17 #include "chrome/browser/managed_mode/managed_user_theme.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/themes/browser_theme_pack.h" 19 #include "chrome/browser/themes/browser_theme_pack.h"
20 #include "chrome/browser/themes/custom_theme_supplier.h" 20 #include "chrome/browser/themes/custom_theme_supplier.h"
21 #include "chrome/browser/themes/theme_properties.h" 21 #include "chrome/browser/themes/theme_properties.h"
22 #include "chrome/browser/themes/theme_syncable_service.h" 22 #include "chrome/browser/themes/theme_syncable_service.h"
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
25 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
26 #include "content/public/browser/user_metrics.h" 26 #include "content/public/browser/user_metrics.h"
27 #include "extensions/common/extension.h"
28 #include "extensions/common/extension_set.h"
27 #include "grit/theme_resources.h" 29 #include "grit/theme_resources.h"
28 #include "grit/ui_resources.h" 30 #include "grit/ui_resources.h"
29 #include "ui/base/layout.h" 31 #include "ui/base/layout.h"
30 #include "ui/base/resource/resource_bundle.h" 32 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/gfx/image/image_skia.h" 33 #include "ui/gfx/image/image_skia.h"
32 34
33 #if defined(OS_WIN) 35 #if defined(OS_WIN)
34 #include "ui/base/win/shell.h" 36 #include "ui/base/win/shell.h"
35 #endif 37 #endif
36 38
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (!profile_ || !ready_) 329 if (!profile_ || !ready_)
328 return; 330 return;
329 if (!ignore_infobars && number_of_infobars_ != 0) 331 if (!ignore_infobars && number_of_infobars_ != 0)
330 return; 332 return;
331 333
332 ExtensionService* service = profile_->GetExtensionService(); 334 ExtensionService* service = profile_->GetExtensionService();
333 if (!service) 335 if (!service)
334 return; 336 return;
335 std::string current_theme = GetThemeID(); 337 std::string current_theme = GetThemeID();
336 std::vector<std::string> remove_list; 338 std::vector<std::string> remove_list;
337 scoped_ptr<const ExtensionSet> extensions( 339 scoped_ptr<const extensions::ExtensionSet> extensions(
338 service->GenerateInstalledExtensionsSet()); 340 service->GenerateInstalledExtensionsSet());
339 extensions::ExtensionPrefs* prefs = service->extension_prefs(); 341 extensions::ExtensionPrefs* prefs = service->extension_prefs();
340 for (ExtensionSet::const_iterator it = extensions->begin(); 342 for (extensions::ExtensionSet::const_iterator it = extensions->begin();
341 it != extensions->end(); ++it) { 343 it != extensions->end(); ++it) {
342 const extensions::Extension* extension = *it; 344 const extensions::Extension* extension = *it;
343 if (extension->is_theme() && 345 if (extension->is_theme() &&
344 extension->id() != current_theme) { 346 extension->id() != current_theme) {
345 // Only uninstall themes which are not disabled or are disabled with 347 // Only uninstall themes which are not disabled or are disabled with
346 // reason DISABLE_USER_ACTION. We cannot blanket uninstall all disabled 348 // reason DISABLE_USER_ACTION. We cannot blanket uninstall all disabled
347 // themes because externally installed themes are initially disabled. 349 // themes because externally installed themes are initially disabled.
348 int disable_reason = prefs->GetDisableReasons(extension->id()); 350 int disable_reason = prefs->GetDisableReasons(extension->id());
349 if (!prefs->IsExtensionDisabled(extension->id()) || 351 if (!prefs->IsExtensionDisabled(extension->id()) ||
350 disable_reason == Extension::DISABLE_USER_ACTION) { 352 disable_reason == Extension::DISABLE_USER_ACTION) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 void ThemeService::OnInfobarDestroyed() { 592 void ThemeService::OnInfobarDestroyed() {
591 number_of_infobars_--; 593 number_of_infobars_--;
592 594
593 if (number_of_infobars_ == 0) 595 if (number_of_infobars_ == 0)
594 RemoveUnusedThemes(false); 596 RemoveUnusedThemes(false);
595 } 597 }
596 598
597 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { 599 ThemeSyncableService* ThemeService::GetThemeSyncableService() const {
598 return theme_syncable_service_.get(); 600 return theme_syncable_service_.get();
599 } 601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698