OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/shortcut_info.h" | 5 #include "chrome/browser/android/shortcut_info.h" |
6 | 6 |
7 ShortcutInfo::ShortcutInfo() | 7 ShortcutInfo::ShortcutInfo() |
8 : display(content::Manifest::DISPLAY_MODE_BROWSER), | 8 : display(content::Manifest::DISPLAY_MODE_BROWSER), |
9 orientation(blink::WebScreenOrientationLockDefault), | 9 orientation(blink::WebScreenOrientationLockDefault), |
10 source(SOURCE_ADD_TO_HOMESCREEN) { | 10 source(SOURCE_ADD_TO_HOMESCREEN), |
| 11 theme_color(content::Manifest::kInvalidOrMissingThemeColor) { |
11 } | 12 } |
12 | 13 |
13 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url) | 14 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url) |
14 : url(shortcut_url), | 15 : url(shortcut_url), |
15 display(content::Manifest::DISPLAY_MODE_BROWSER), | 16 display(content::Manifest::DISPLAY_MODE_BROWSER), |
16 orientation(blink::WebScreenOrientationLockDefault), | 17 orientation(blink::WebScreenOrientationLockDefault), |
17 source(SOURCE_ADD_TO_HOMESCREEN) { | 18 source(SOURCE_ADD_TO_HOMESCREEN), |
| 19 theme_color(content::Manifest::kInvalidOrMissingThemeColor) { |
18 } | 20 } |
19 | 21 |
20 ShortcutInfo::~ShortcutInfo() { | 22 ShortcutInfo::~ShortcutInfo() { |
21 } | 23 } |
22 | 24 |
23 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { | 25 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { |
24 if (!manifest.short_name.is_null()) | 26 if (!manifest.short_name.is_null()) |
25 short_name = manifest.short_name.string(); | 27 short_name = manifest.short_name.string(); |
26 if (!manifest.name.is_null()) | 28 if (!manifest.name.is_null()) |
27 name = manifest.name.string(); | 29 name = manifest.name.string(); |
(...skipping 21 matching lines...) Expand all Loading... |
49 display = content::Manifest::DISPLAY_MODE_BROWSER; | 51 display = content::Manifest::DISPLAY_MODE_BROWSER; |
50 | 52 |
51 // Set the orientation based on the manifest value, if any. | 53 // Set the orientation based on the manifest value, if any. |
52 if (manifest.orientation != blink::WebScreenOrientationLockDefault) { | 54 if (manifest.orientation != blink::WebScreenOrientationLockDefault) { |
53 // Ignore the orientation if the display mode is different from | 55 // Ignore the orientation if the display mode is different from |
54 // 'standalone'. | 56 // 'standalone'. |
55 // TODO(mlamouri): send a message to the developer console about this. | 57 // TODO(mlamouri): send a message to the developer console about this. |
56 if (display == content::Manifest::DISPLAY_MODE_STANDALONE) | 58 if (display == content::Manifest::DISPLAY_MODE_STANDALONE) |
57 orientation = manifest.orientation; | 59 orientation = manifest.orientation; |
58 } | 60 } |
| 61 |
| 62 // Set the theme color based on the manifest value, if any. |
| 63 if (manifest.theme_color != content::Manifest::kInvalidOrMissingThemeColor) |
| 64 theme_color = manifest.theme_color; |
59 } | 65 } |
60 | 66 |
61 void ShortcutInfo::UpdateSource(const Source new_source) { | 67 void ShortcutInfo::UpdateSource(const Source new_source) { |
62 source = new_source; | 68 source = new_source; |
63 } | 69 } |
OLD | NEW |