OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/theme_properties.h" | 5 #include "chrome/browser/themes/theme_properties.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "chrome/browser/themes/browser_theme_pack.h" | 12 #include "chrome/browser/themes/browser_theme_pack.h" |
13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
14 #include "ui/base/material_design/material_design_controller.h" | 14 #include "ui/base/material_design/material_design_controller.h" |
15 #include "ui/gfx/color_palette.h" | 15 #include "ui/gfx/color_palette.h" |
16 #include "ui/resources/grit/ui_resources.h" | 16 #include "ui/resources/grit/ui_resources.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // ---------------------------------------------------------------------------- | 20 // ---------------------------------------------------------------------------- |
21 // Defaults for properties which are stored in the browser theme pack. If you | 21 // Defaults for properties which are stored in the browser theme pack. If you |
22 // change these defaults, you must increment the version number in | 22 // change these defaults, you must increment the version number in |
23 // browser_theme_pack.cc. | 23 // browser_theme_pack.cc. |
24 | 24 |
25 // Default colors. | 25 // Default colors. |
26 #if defined(OS_CHROMEOS) | 26 #if defined(OS_MACOSX) |
27 // Used for theme fallback colors. | 27 // Used for theme fallback colors. |
28 const SkColor kDefaultColorFrame[] = { | 28 const SkColor kDefaultColorFrame[] = { |
29 SkColorSetRGB(0xC3, 0xC3, 0xC4), SkColorSetRGB(204, 204, 204)}; | |
30 const SkColor kDefaultColorFrameInactive[] = { | |
31 SkColorSetRGB(0xCD, 0xCD, 0xCE), SkColorSetRGB(220, 220, 220)}; | |
32 #elif defined(OS_MACOSX) | |
33 const SkColor kDefaultColorFrame[] = { | |
34 SkColorSetRGB(224, 224, 224), SkColorSetRGB(204, 204, 204)}; | 29 SkColorSetRGB(224, 224, 224), SkColorSetRGB(204, 204, 204)}; |
35 const SkColor kDefaultColorFrameInactive[] = { | 30 const SkColor kDefaultColorFrameInactive[] = { |
36 SkColorSetRGB(246, 246, 246), SkColorSetRGB(246, 246, 246)}; | 31 SkColorSetRGB(246, 246, 246), SkColorSetRGB(246, 246, 246)}; |
37 #else | 32 #else |
38 const SkColor kDefaultColorFrame = SkColorSetRGB(66, 116, 201); | 33 const SkColor kDefaultColorFrame[] = { |
39 const SkColor kDefaultColorFrameInactive = SkColorSetRGB(161, 182, 228); | 34 SkColorSetRGB(0xC3, 0xC3, 0xC4), SkColorSetRGB(204, 204, 204)}; |
40 #endif // OS_CHROMEOS | 35 const SkColor kDefaultColorFrameInactive[] = { |
| 36 SkColorSetRGB(0xCD, 0xCD, 0xCE), SkColorSetRGB(220, 220, 220)}; |
| 37 #endif |
41 | 38 |
42 // These colors are the same between CrOS and !CrOS for MD, so this ifdef can be | 39 // These colors are the same between CrOS and !CrOS for MD, so this ifdef can be |
43 // removed when we stop supporting pre-MD. | 40 // removed when we stop supporting pre-MD. |
44 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
45 const SkColor kDefaultColorFrameIncognito[] = {SkColorSetRGB(0xA0, 0xA0, 0xA4), | 42 const SkColor kDefaultColorFrameIncognito[] = {SkColorSetRGB(0xA0, 0xA0, 0xA4), |
46 SkColorSetRGB(0x28, 0x2B, 0x2D)}; | 43 SkColorSetRGB(0x28, 0x2B, 0x2D)}; |
47 const SkColor kDefaultColorFrameIncognitoInactive[] = { | 44 const SkColor kDefaultColorFrameIncognitoInactive[] = { |
48 SkColorSetRGB(0xAA, 0xAA, 0xAE), SkColorSetRGB(0x14, 0x17, 0x19)}; | 45 SkColorSetRGB(0xAA, 0xAA, 0xAE), SkColorSetRGB(0x14, 0x17, 0x19)}; |
49 #elif defined(OS_MACOSX) | 46 #elif defined(OS_MACOSX) |
50 const SkColor kDefaultColorFrameIncognito[] = { | 47 const SkColor kDefaultColorFrameIncognito[] = { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 return {-1, -1, -1}; | 294 return {-1, -1, -1}; |
298 } | 295 } |
299 } | 296 } |
300 | 297 |
301 // static | 298 // static |
302 SkColor ThemeProperties::GetDefaultColor(int id, bool otr) { | 299 SkColor ThemeProperties::GetDefaultColor(int id, bool otr) { |
303 int mode = ui::MaterialDesignController::IsModeMaterial(); | 300 int mode = ui::MaterialDesignController::IsModeMaterial(); |
304 switch (id) { | 301 switch (id) { |
305 // Properties stored in theme pack. | 302 // Properties stored in theme pack. |
306 case COLOR_FRAME: | 303 case COLOR_FRAME: |
307 if (otr) | 304 return otr ? kDefaultColorFrameIncognito[mode] : kDefaultColorFrame[mode]; |
308 return kDefaultColorFrameIncognito[mode]; | |
309 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | |
310 return kDefaultColorFrame[mode]; | |
311 #else | |
312 return kDefaultColorFrame; | |
313 #endif // OS_CHROMEOS || OS_MACOSX | |
314 case COLOR_FRAME_INACTIVE: | 305 case COLOR_FRAME_INACTIVE: |
315 if (otr) | 306 return otr ? kDefaultColorFrameIncognitoInactive[mode] |
316 return kDefaultColorFrameIncognitoInactive[mode]; | 307 : kDefaultColorFrameInactive[mode]; |
317 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | |
318 return kDefaultColorFrameInactive[mode]; | |
319 #else | |
320 return kDefaultColorFrameInactive; | |
321 #endif // OS_CHROMEOS || OS_MACOSX | |
322 case COLOR_TOOLBAR: | 308 case COLOR_TOOLBAR: |
323 return otr ? kDefaultColorToolbarIncognito[mode] | 309 return otr ? kDefaultColorToolbarIncognito[mode] |
324 : kDefaultColorToolbar[mode]; | 310 : kDefaultColorToolbar[mode]; |
325 case COLOR_TAB_TEXT: | 311 case COLOR_TAB_TEXT: |
326 return otr ? kDefaultColorTabTextIncognito[mode] | 312 return otr ? kDefaultColorTabTextIncognito[mode] |
327 : kDefaultColorTabText; | 313 : kDefaultColorTabText; |
328 case COLOR_BACKGROUND_TAB_TEXT: | 314 case COLOR_BACKGROUND_TAB_TEXT: |
329 return otr ? kDefaultColorBackgroundTabTextIncognito[mode] | 315 return otr ? kDefaultColorBackgroundTabTextIncognito[mode] |
330 : kDefaultColorBackgroundTabText[mode]; | 316 : kDefaultColorBackgroundTabText[mode]; |
331 case COLOR_BOOKMARK_TEXT: | 317 case COLOR_BOOKMARK_TEXT: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 #endif | 377 #endif |
392 case COLOR_FRAME_INCOGNITO: | 378 case COLOR_FRAME_INCOGNITO: |
393 case COLOR_FRAME_INCOGNITO_INACTIVE: | 379 case COLOR_FRAME_INCOGNITO_INACTIVE: |
394 NOTREACHED() << "These values should be queried via their respective " | 380 NOTREACHED() << "These values should be queried via their respective " |
395 "non-incognito equivalents and an appropriate |otr| " | 381 "non-incognito equivalents and an appropriate |otr| " |
396 "value."; | 382 "value."; |
397 default: | 383 default: |
398 return gfx::kPlaceholderColor; | 384 return gfx::kPlaceholderColor; |
399 } | 385 } |
400 } | 386 } |
OLD | NEW |