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

Side by Side Diff: chrome/browser/browser_theme_provider.cc

Issue 200080: Force preferences to save immediately when a theme is set, so that a browser ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser_theme_provider.h" 5 #include "chrome/browser/browser_theme_provider.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/gfx/png_decoder.h" 9 #include "base/gfx/png_decoder.h"
10 #include "base/gfx/png_encoder.h" 10 #include "base/gfx/png_encoder.h"
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 DictionaryValue* pref_images = 1084 DictionaryValue* pref_images =
1085 profile_->GetPrefs()->GetMutableDictionary(prefs::kCurrentThemeImages); 1085 profile_->GetPrefs()->GetMutableDictionary(prefs::kCurrentThemeImages);
1086 1086
1087 for (ImagesDiskCache::iterator it = images_disk_cache_.begin(); 1087 for (ImagesDiskCache::iterator it = images_disk_cache_.begin();
1088 it != images_disk_cache_.end(); it++) { 1088 it != images_disk_cache_.end(); it++) {
1089 std::wstring disk_path = it->first.ToWStringHack(); 1089 std::wstring disk_path = it->first.ToWStringHack();
1090 std::string pref_name = resource_names_[it->second]; 1090 std::string pref_name = resource_names_[it->second];
1091 pref_images->SetString(UTF8ToWide(pref_name), 1091 pref_images->SetString(UTF8ToWide(pref_name),
1092 WideToUTF8(disk_path)); 1092 WideToUTF8(disk_path));
1093 } 1093 }
1094 profile_->GetPrefs()->SavePersistentPrefs();
1094 } 1095 }
1095 1096
1096 void BrowserThemeProvider::SaveImageData(DictionaryValue* images_value) { 1097 void BrowserThemeProvider::SaveImageData(DictionaryValue* images_value) {
1097 // Save our images data. 1098 // Save our images data.
1098 DictionaryValue* pref_images = 1099 DictionaryValue* pref_images =
1099 profile_->GetPrefs()->GetMutableDictionary(prefs::kCurrentThemeImages); 1100 profile_->GetPrefs()->GetMutableDictionary(prefs::kCurrentThemeImages);
1100 pref_images->Clear(); 1101 pref_images->Clear();
1101 1102
1102 if (images_value) { 1103 if (images_value) {
1103 DictionaryValue::key_iterator iter = images_value->begin_keys(); 1104 DictionaryValue::key_iterator iter = images_value->begin_keys();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 } 1247 }
1247 image_cache_.clear(); 1248 image_cache_.clear();
1248 images_disk_cache_.clear(); 1249 images_disk_cache_.clear();
1249 } 1250 }
1250 1251
1251 #if defined(TOOLKIT_VIEWS) 1252 #if defined(TOOLKIT_VIEWS)
1252 void BrowserThemeProvider::FreePlatformCaches() { 1253 void BrowserThemeProvider::FreePlatformCaches() {
1253 // Views (Skia) has no platform image cache to clear. 1254 // Views (Skia) has no platform image cache to clear.
1254 } 1255 }
1255 #endif 1256 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698