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

Unified Diff: chrome/browser/browser_theme_provider.cc

Issue 159705: Implement kCurrentThemeID so we can know what the last theme to be installed ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « chrome/browser/browser_theme_provider.h ('k') | chrome/browser/profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_theme_provider.cc
===================================================================
--- chrome/browser/browser_theme_provider.cc (revision 22263)
+++ chrome/browser/browser_theme_provider.cc (working copy)
@@ -126,6 +126,9 @@
const skia::HSL BrowserThemeProvider::kDefaultTintBackgroundTab =
{ -1, 0.5, 0.75 };
+// Saved default values.
+const char* BrowserThemeProvider::kDefaultThemeID = "";
+
// Default display properties.
static const int kDefaultDisplayPropertyNTPAlignment =
BrowserThemeProvider::ALIGN_BOTTOM;
@@ -369,6 +372,7 @@
SaveColorData();
SaveTintData();
SaveDisplayPropertyData();
+ SaveThemeID(extension->id());
NotifyThemeChanged();
UserMetrics::RecordAction(L"Themes_Installed", profile_);
@@ -380,6 +384,11 @@
UserMetrics::RecordAction(L"Themes_Reset", profile_);
}
+std::string BrowserThemeProvider::GetThemeID() {
+ std::wstring id = profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
+ return WideToUTF8(id);
+}
+
bool BrowserThemeProvider::ReadThemeFileData(
int id, std::vector<unsigned char>* raw_data) {
if (images_.count(id)) {
@@ -776,6 +785,7 @@
SaveColorData();
SaveTintData();
SaveDisplayPropertyData();
+ SaveThemeID(kDefaultThemeID);
}
SkBitmap* BrowserThemeProvider::GenerateBitmap(int id) {
@@ -905,6 +915,10 @@
}
}
+void BrowserThemeProvider::SaveThemeID(const std::string& id) {
+ profile_->GetPrefs()->SetString(prefs::kCurrentThemeID, UTF8ToWide(id));
+}
+
void BrowserThemeProvider::NotifyThemeChanged() {
// Redraw!
NotificationService* service = NotificationService::current();
« no previous file with comments | « chrome/browser/browser_theme_provider.h ('k') | chrome/browser/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698