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

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

Issue 6532033: Disable "Reset to Default theme"/"Use classic theme" correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_theme_provider.h" 5 #include "chrome/browser/themes/browser_theme_provider.h"
6 6
7 #include "base/string_split.h" 7 #include "base/string_split.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 17 matching lines...) Expand all
28 const char* BrowserThemeProvider::kAlignmentBottom = "bottom"; 28 const char* BrowserThemeProvider::kAlignmentBottom = "bottom";
29 const char* BrowserThemeProvider::kAlignmentLeft = "left"; 29 const char* BrowserThemeProvider::kAlignmentLeft = "left";
30 const char* BrowserThemeProvider::kAlignmentRight = "right"; 30 const char* BrowserThemeProvider::kAlignmentRight = "right";
31 31
32 // Strings used in background tiling repetition properties. 32 // Strings used in background tiling repetition properties.
33 const char* BrowserThemeProvider::kTilingNoRepeat = "no-repeat"; 33 const char* BrowserThemeProvider::kTilingNoRepeat = "no-repeat";
34 const char* BrowserThemeProvider::kTilingRepeatX = "repeat-x"; 34 const char* BrowserThemeProvider::kTilingRepeatX = "repeat-x";
35 const char* BrowserThemeProvider::kTilingRepeatY = "repeat-y"; 35 const char* BrowserThemeProvider::kTilingRepeatY = "repeat-y";
36 const char* BrowserThemeProvider::kTilingRepeat = "repeat"; 36 const char* BrowserThemeProvider::kTilingRepeat = "repeat";
37 37
38 // Saved default values. 38 // The default theme if we haven't installed a theme yet or if we've clicked
39 // the "Use Classic" button.
39 const char* BrowserThemeProvider::kDefaultThemeID = ""; 40 const char* BrowserThemeProvider::kDefaultThemeID = "";
40 41
41 namespace { 42 namespace {
42 43
44 // The default theme if we've gone to the theme gallery and installed the
45 // "Default" theme. We have to detect this case specifically. (By the time we
46 // realize we've installed the default theme, we already have an extension
47 // unpacked on the filesystem.)
48 const char* kDefatulThemeGalleryID = "hkacjpbfdknhflllbcmjibkdeoafencn";
Miranda Callahan 2011/02/17 21:41:46 s/fatul/fault ;-)
49
43 SkColor TintForUnderline(SkColor input) { 50 SkColor TintForUnderline(SkColor input) {
44 return SkColorSetA(input, SkColorGetA(input) / 3); 51 return SkColorSetA(input, SkColorGetA(input) / 3);
45 } 52 }
46 53
47 SkColor IncreaseLightness(SkColor color, double percent) { 54 SkColor IncreaseLightness(SkColor color, double percent) {
48 color_utils::HSL result; 55 color_utils::HSL result;
49 color_utils::SkColorToHSL(color, &result); 56 color_utils::SkColorToHSL(color, &result);
50 result.l += (1 - result.l) * percent; 57 result.l += (1 - result.l) * percent;
51 return color_utils::HSLToSkColor(result, SkColorGetA(color)); 58 return color_utils::HSLToSkColor(result, SkColorGetA(color));
52 } 59 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ClearAllThemeData(); 331 ClearAllThemeData();
325 NotifyThemeChanged(NULL); 332 NotifyThemeChanged(NULL);
326 UserMetrics::RecordAction(UserMetricsAction("Themes_Reset"), profile_); 333 UserMetrics::RecordAction(UserMetricsAction("Themes_Reset"), profile_);
327 } 334 }
328 335
329 void BrowserThemeProvider::SetNativeTheme() { 336 void BrowserThemeProvider::SetNativeTheme() {
330 UseDefaultTheme(); 337 UseDefaultTheme();
331 } 338 }
332 339
333 bool BrowserThemeProvider::UsingDefaultTheme() { 340 bool BrowserThemeProvider::UsingDefaultTheme() {
334 return GetThemeID() == BrowserThemeProvider::kDefaultThemeID; 341 std::string id = GetThemeID();
342 return id == BrowserThemeProvider::kDefaultThemeID ||
343 id == kDefatulThemeGalleryID;
Miranda Callahan 2011/02/17 21:41:46 I actually kind of like the word "Defatul," but st
Evan Stade 2011/02/17 22:13:17 I wonder, how do you pronounce it?
335 } 344 }
336 345
337 std::string BrowserThemeProvider::GetThemeID() const { 346 std::string BrowserThemeProvider::GetThemeID() const {
338 return profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); 347 return profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
339 } 348 }
340 349
341 // static 350 // static
342 std::string BrowserThemeProvider::AlignmentToString(int alignment) { 351 std::string BrowserThemeProvider::AlignmentToString(int alignment) {
343 // Convert from an AlignmentProperty back into a string. 352 // Convert from an AlignmentProperty back into a string.
344 std::string vertical_string; 353 std::string vertical_string;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 void BrowserThemeProvider::OnInfobarDisplayed() { 635 void BrowserThemeProvider::OnInfobarDisplayed() {
627 number_of_infobars_++; 636 number_of_infobars_++;
628 } 637 }
629 638
630 void BrowserThemeProvider::OnInfobarDestroyed() { 639 void BrowserThemeProvider::OnInfobarDestroyed() {
631 number_of_infobars_--; 640 number_of_infobars_--;
632 641
633 if (number_of_infobars_ == 0) 642 if (number_of_infobars_ == 0)
634 RemoveUnusedThemes(); 643 RemoveUnusedThemes();
635 } 644 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/options/personal_options_handler.cc ('k') | chrome/browser/ui/gtk/options/content_page_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698