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

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

Issue 2703213003: Revert "Improve the resolution of the menu item homescreen launch source metric." (Closed)
Patch Set: Created 3 years, 10 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::WebDisplayModeBrowser), 9 display(blink::WebDisplayModeBrowser),
10 orientation(blink::WebScreenOrientationLockDefault), 10 orientation(blink::WebScreenOrientationLockDefault),
11 source(SOURCE_ADD_TO_HOMESCREEN_SHORTCUT), 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 }
14 15
15 ShortcutInfo::ShortcutInfo(const ShortcutInfo& other) = default; 16 ShortcutInfo::ShortcutInfo(const ShortcutInfo& other) = default;
16 17
17 ShortcutInfo::~ShortcutInfo() { 18 ShortcutInfo::~ShortcutInfo() {
18 } 19 }
19 20
20 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { 21 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) {
21 if (!manifest.short_name.is_null()) 22 if (!manifest.short_name.is_null())
22 short_name = manifest.short_name.string(); 23 short_name = manifest.short_name.string();
23 if (!manifest.name.is_null()) 24 if (!manifest.name.is_null())
(...skipping 10 matching lines...) Expand all
34 if (manifest.start_url.is_valid()) 35 if (manifest.start_url.is_valid())
35 url = manifest.start_url; 36 url = manifest.start_url;
36 37
37 if (manifest.scope.is_valid()) 38 if (manifest.scope.is_valid())
38 scope = manifest.scope; 39 scope = manifest.scope;
39 40
40 // Set the display based on the manifest value, if any. 41 // Set the display based on the manifest value, if any.
41 if (manifest.display != blink::WebDisplayModeUndefined) 42 if (manifest.display != blink::WebDisplayModeUndefined)
42 display = manifest.display; 43 display = manifest.display;
43 44
44 // 'minimal-ui' is not yet supported (see crbug.com/604390). Otherwise, set 45 // 'minimal-ui' is not yet supported, so fallback in this case.
45 // the source to be standalone if appropriate. 46 // See crbug.com/604390.
46 if (manifest.display == blink::WebDisplayModeMinimalUi) { 47 if (manifest.display == blink::WebDisplayModeMinimalUi)
47 display = blink::WebDisplayModeBrowser; 48 display = blink::WebDisplayModeBrowser;
48 } else if (display == blink::WebDisplayModeStandalone ||
49 display == blink::WebDisplayModeFullscreen) {
50 source = SOURCE_ADD_TO_HOMESCREEN_STANDALONE;
51 }
52 49
53 // Set the orientation based on the manifest value, if any. 50 // Set the orientation based on the manifest value, if any.
54 if (manifest.orientation != blink::WebScreenOrientationLockDefault) { 51 if (manifest.orientation != blink::WebScreenOrientationLockDefault) {
55 // Ignore the orientation if the display mode is different from 52 // Ignore the orientation if the display mode is different from
56 // 'standalone' or 'fullscreen'. 53 // 'standalone' or 'fullscreen'.
57 // TODO(mlamouri): send a message to the developer console about this. 54 // TODO(mlamouri): send a message to the developer console about this.
58 if (display == blink::WebDisplayModeStandalone || 55 if (display == blink::WebDisplayModeStandalone ||
59 display == blink::WebDisplayModeFullscreen) { 56 display == blink::WebDisplayModeFullscreen) {
60 orientation = manifest.orientation; 57 orientation = manifest.orientation;
61 } 58 }
62 } 59 }
63 60
64 // Set the theme color based on the manifest value, if any. 61 // Set the theme color based on the manifest value, if any.
65 if (manifest.theme_color != content::Manifest::kInvalidOrMissingColor) 62 if (manifest.theme_color != content::Manifest::kInvalidOrMissingColor)
66 theme_color = manifest.theme_color; 63 theme_color = manifest.theme_color;
67 64
68 // Set the background color based on the manifest value, if any. 65 // Set the background color based on the manifest value, if any.
69 if (manifest.background_color != content::Manifest::kInvalidOrMissingColor) 66 if (manifest.background_color != content::Manifest::kInvalidOrMissingColor)
70 background_color = manifest.background_color; 67 background_color = manifest.background_color;
71 68
72 // Set the icon urls based on the icons in the manifest, if any. 69 // Set the icon urls based on the icons in the manifest, if any.
73 icon_urls.clear(); 70 icon_urls.clear();
74 for (const content::Manifest::Icon& icon : manifest.icons) 71 for (const content::Manifest::Icon& icon : manifest.icons)
75 icon_urls.push_back(icon.src.spec()); 72 icon_urls.push_back(icon.src.spec());
76 } 73 }
77 74
78 void ShortcutInfo::UpdateSource(const Source new_source) { 75 void ShortcutInfo::UpdateSource(const Source new_source) {
79 source = new_source; 76 source = new_source;
80 } 77 }
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_info.h ('k') | chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698