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

Side by Side Diff: chrome/browser/android/shortcut_info.cc

Issue 2948313002: [Android] Suggest page title for homescreen shortcut when Web Manifest is empty (Closed)
Patch Set: Merge branch 'master' into ignore Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_info_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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::kWebDisplayModeBrowser), 9 display(blink::kWebDisplayModeBrowser),
10 orientation(blink::kWebScreenOrientationLockDefault), 10 orientation(blink::kWebScreenOrientationLockDefault),
11 source(SOURCE_ADD_TO_HOMESCREEN_SHORTCUT), 11 source(SOURCE_ADD_TO_HOMESCREEN_SHORTCUT),
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 ideal_splash_image_size_in_px(0), 14 ideal_splash_image_size_in_px(0),
15 minimum_splash_image_size_in_px(0) {} 15 minimum_splash_image_size_in_px(0) {}
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.short_name.is_null()) 23 if (!manifest.short_name.string().empty() ||
24 !manifest.name.string().empty()) {
24 short_name = manifest.short_name.string(); 25 short_name = manifest.short_name.string();
25 if (!manifest.name.is_null())
26 name = manifest.name.string(); 26 name = manifest.name.string();
27 if (manifest.short_name.is_null() != manifest.name.is_null()) { 27 if (short_name.empty())
28 if (manifest.short_name.is_null())
29 short_name = name; 28 short_name = name;
30 else 29 else if (name.empty())
31 name = short_name; 30 name = short_name;
32 } 31 }
33 user_title = short_name; 32 user_title = short_name;
34 33
35 // Set the url based on the manifest value, if any. 34 // Set the url based on the manifest value, if any.
36 if (manifest.start_url.is_valid()) 35 if (manifest.start_url.is_valid())
37 url = manifest.start_url; 36 url = manifest.start_url;
38 37
39 if (manifest.scope.is_valid()) 38 if (manifest.scope.is_valid())
40 scope = manifest.scope; 39 scope = manifest.scope;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 72
74 // Set the icon urls based on the icons in the manifest, if any. 73 // Set the icon urls based on the icons in the manifest, if any.
75 icon_urls.clear(); 74 icon_urls.clear();
76 for (const content::Manifest::Icon& icon : manifest.icons) 75 for (const content::Manifest::Icon& icon : manifest.icons)
77 icon_urls.push_back(icon.src.spec()); 76 icon_urls.push_back(icon.src.spec());
78 } 77 }
79 78
80 void ShortcutInfo::UpdateSource(const Source new_source) { 79 void ShortcutInfo::UpdateSource(const Source new_source) {
81 source = new_source; 80 source = new_source;
82 } 81 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698