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

Unified Diff: chrome/browser/themes/theme_service.cc

Issue 1906563002: [WIP] Fire a theme changed notification when device scan completes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Recalculate tab and new tab button sizes Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/themes/theme_service.cc
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 11e8f1767a9b9aa2ed06f5019d260690fb9e900e..f696bf418b2b2412c1d5e82e99dad6b2237999b3 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -41,6 +41,7 @@
#include "ui/base/layout.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/events/devices/device_data_manager.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/native_theme/common_theme.h"
@@ -213,6 +214,8 @@ ThemeService::ThemeService()
weak_ptr_factory_(this) {}
ThemeService::~ThemeService() {
+ if (ui::DeviceDataManager::HasInstance())
+ ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
FreePlatformCaches();
}
@@ -220,6 +223,9 @@ void ThemeService::Init(Profile* profile) {
DCHECK(CalledOnValidThread());
profile_ = profile;
+ if (ui::DeviceDataManager::HasInstance())
+ ui::DeviceDataManager::GetInstance()->AddObserver(this); // move to ctor?
+
LoadThemePrefs();
registrar_.Add(this,
@@ -257,6 +263,11 @@ void ThemeService::Observe(int type,
}
}
+void ThemeService::OnDeviceListsComplete() {
+ if (ui::MaterialDesignController::DeviceListsComplete())
+ NotifyThemeChanged();
+}
+
void ThemeService::SetTheme(const Extension* extension) {
DCHECK(extension->is_theme());
ExtensionService* service =

Powered by Google App Engine
This is Rietveld 408576698