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

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

Issue 2915913002: [WebAPKs] Display same text for menu & engagement banner (Closed)
Patch Set: Merge branch 'same_infobar_title0' into same_infobar_title Created 3 years, 6 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
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) {
dominickn 2017/06/02 01:42:25 Please add: DCHECK(!short_name.empty() || !name.e
pkotwicz 2017/06/02 15:53:53 UpdateManifest() might be called with an empty sho
dominickn 2017/06/06 00:20:58 Good catch. That's not great - it means we'll show
pkotwicz 2017/06/07 02:22:33 Ok, I have changed the logic to be a no-op if the
23 if (!manifest.short_name.is_null()) 23 short_name = manifest.short_name.string();
24 short_name = manifest.short_name.string(); 24 name = manifest.name.string();
25 if (!manifest.name.is_null()) 25 if (short_name.empty())
26 name = manifest.name.string(); 26 short_name = name;
27 if (manifest.short_name.is_null() != manifest.name.is_null()) { 27 else if (name.empty())
28 if (manifest.short_name.is_null()) 28 name = short_name;
29 short_name = name;
30 else
31 name = short_name;
32 }
33 user_title = short_name; 29 user_title = short_name;
34 30
35 // Set the url based on the manifest value, if any. 31 // Set the url based on the manifest value, if any.
36 if (manifest.start_url.is_valid()) 32 if (manifest.start_url.is_valid())
37 url = manifest.start_url; 33 url = manifest.start_url;
38 34
39 if (manifest.scope.is_valid()) 35 if (manifest.scope.is_valid())
40 scope = manifest.scope; 36 scope = manifest.scope;
41 37
42 // Set the display based on the manifest value, if any. 38 // Set the display based on the manifest value, if any.
(...skipping 30 matching lines...) Expand all
73 69
74 // Set the icon urls based on the icons in the manifest, if any. 70 // Set the icon urls based on the icons in the manifest, if any.
75 icon_urls.clear(); 71 icon_urls.clear();
76 for (const content::Manifest::Icon& icon : manifest.icons) 72 for (const content::Manifest::Icon& icon : manifest.icons)
77 icon_urls.push_back(icon.src.spec()); 73 icon_urls.push_back(icon.src.spec());
78 } 74 }
79 75
80 void ShortcutInfo::UpdateSource(const Source new_source) { 76 void ShortcutInfo::UpdateSource(const Source new_source) {
81 source = new_source; 77 source = new_source;
82 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698