summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_theme_provider.cc
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-03 16:34:34 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-03 16:34:34 +0000
commit51c490b5cb0ff02f391e514cfa2ba892e08a2edc (patch)
treea576c2399f37016a495997786fd6d9244912944d /chrome/browser/browser_theme_provider.cc
parentcf76214c53788effec9c2e9cf14dbfc91887921e (diff)
downloadchromium_src-51c490b5cb0ff02f391e514cfa2ba892e08a2edc.zip
chromium_src-51c490b5cb0ff02f391e514cfa2ba892e08a2edc.tar.gz
chromium_src-51c490b5cb0ff02f391e514cfa2ba892e08a2edc.tar.bz2
Implement kCurrentThemeID so we can know what the last theme to be installed was.
BUG=none TEST=not visible in UI Review URL: http://codereview.chromium.org/159705 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22270 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_theme_provider.cc')
-rw-r--r--chrome/browser/browser_theme_provider.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc
index 9e6b9ec..116b4d8 100644
--- a/chrome/browser/browser_theme_provider.cc
+++ b/chrome/browser/browser_theme_provider.cc
@@ -126,6 +126,9 @@ const skia::HSL BrowserThemeProvider::kDefaultTintFrameIncognitoInactive =
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 @@ void BrowserThemeProvider::SetTheme(Extension* extension) {
SaveColorData();
SaveTintData();
SaveDisplayPropertyData();
+ SaveThemeID(extension->id());
NotifyThemeChanged();
UserMetrics::RecordAction(L"Themes_Installed", profile_);
@@ -380,6 +384,11 @@ void BrowserThemeProvider::UseDefaultTheme() {
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 @@ void BrowserThemeProvider::ClearAllThemeData() {
SaveColorData();
SaveTintData();
SaveDisplayPropertyData();
+ SaveThemeID(kDefaultThemeID);
}
SkBitmap* BrowserThemeProvider::GenerateBitmap(int id) {
@@ -905,6 +915,10 @@ void BrowserThemeProvider::SaveDisplayPropertyData() {
}
}
+void BrowserThemeProvider::SaveThemeID(const std::string& id) {
+ profile_->GetPrefs()->SetString(prefs::kCurrentThemeID, UTF8ToWide(id));
+}
+
void BrowserThemeProvider::NotifyThemeChanged() {
// Redraw!
NotificationService* service = NotificationService::current();