Chromium Code Reviews| 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(const GURL& shortcut_url) | 7 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url) |
| 8 : url(shortcut_url), | 8 : url(shortcut_url), |
| 9 display(blink::WebDisplayModeBrowser), | 9 display(blink::WebDisplayModeBrowser), |
| 10 orientation(blink::WebScreenOrientationLockDefault), | 10 orientation(blink::WebScreenOrientationLockDefault), |
| 11 source(SOURCE_ADD_TO_HOMESCREEN), | 11 source(SOURCE_ADD_TO_HOMESCREEN), |
| 12 theme_color(content::Manifest::kInvalidOrMissingColor), | 12 theme_color(content::Manifest::kInvalidOrMissingColor), |
| 13 background_color(content::Manifest::kInvalidOrMissingColor), | 13 background_color(content::Manifest::kInvalidOrMissingColor), |
| 14 is_icon_generated(false) { | 14 is_icon_generated(false) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 ShortcutInfo::ShortcutInfo(const ShortcutInfo& other) = default; | 17 ShortcutInfo::ShortcutInfo(const ShortcutInfo& other) = default; |
| 18 | 18 |
| 19 ShortcutInfo::~ShortcutInfo() { | 19 ShortcutInfo::~ShortcutInfo() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { | 22 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { |
| 23 if (manifest.url.is_valid()) | |
|
dominickn
2016/06/15 19:17:14
Perhaps this should be checked in the manifest par
pkotwicz
2016/06/15 20:34:24
I removed the check. You are right that manifest.u
| |
| 24 manifest_url = manifest.url; | |
| 25 | |
| 23 if (!manifest.short_name.is_null()) | 26 if (!manifest.short_name.is_null()) |
| 24 short_name = manifest.short_name.string(); | 27 short_name = manifest.short_name.string(); |
| 25 if (!manifest.name.is_null()) | 28 if (!manifest.name.is_null()) |
| 26 name = manifest.name.string(); | 29 name = manifest.name.string(); |
| 27 if (manifest.short_name.is_null() != manifest.name.is_null()) { | 30 if (manifest.short_name.is_null() != manifest.name.is_null()) { |
| 28 if (manifest.short_name.is_null()) | 31 if (manifest.short_name.is_null()) |
| 29 short_name = name; | 32 short_name = name; |
| 30 else | 33 else |
| 31 name = short_name; | 34 name = short_name; |
| 32 } | 35 } |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 59 theme_color = manifest.theme_color; | 62 theme_color = manifest.theme_color; |
| 60 | 63 |
| 61 // Set the background color based on the manifest value, if any. | 64 // Set the background color based on the manifest value, if any. |
| 62 if (manifest.background_color != content::Manifest::kInvalidOrMissingColor) | 65 if (manifest.background_color != content::Manifest::kInvalidOrMissingColor) |
| 63 background_color = manifest.background_color; | 66 background_color = manifest.background_color; |
| 64 } | 67 } |
| 65 | 68 |
| 66 void ShortcutInfo::UpdateSource(const Source new_source) { | 69 void ShortcutInfo::UpdateSource(const Source new_source) { |
| 67 source = new_source; | 70 source = new_source; |
| 68 } | 71 } |
| OLD | NEW |