[Eraser strings] Remove unused Supervised User infobar and corresponding strings
[chromium-blink-merge.git] / chrome / browser / android / shortcut_info.cc
blobf6803b1c56b5a29bf90313103a8dbfae550bfebc
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
3 // found in the LICENSE file.
5 #include "chrome/browser/android/shortcut_info.h"
7 ShortcutInfo::ShortcutInfo()
8 : display(blink::WebDisplayModeBrowser),
9 orientation(blink::WebScreenOrientationLockDefault),
10 source(SOURCE_ADD_TO_HOMESCREEN),
11 theme_color(content::Manifest::kInvalidOrMissingThemeColor) {
14 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url)
15 : url(shortcut_url),
16 display(blink::WebDisplayModeBrowser),
17 orientation(blink::WebScreenOrientationLockDefault),
18 source(SOURCE_ADD_TO_HOMESCREEN),
19 theme_color(content::Manifest::kInvalidOrMissingThemeColor) {
22 ShortcutInfo::~ShortcutInfo() {
25 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) {
26 if (!manifest.short_name.is_null())
27 short_name = manifest.short_name.string();
28 if (!manifest.name.is_null())
29 name = manifest.name.string();
30 if (manifest.short_name.is_null() != manifest.name.is_null()) {
31 if (manifest.short_name.is_null())
32 short_name = name;
33 else
34 name = short_name;
36 user_title = short_name;
38 // Set the url based on the manifest value, if any.
39 if (manifest.start_url.is_valid())
40 url = manifest.start_url;
42 // Set the display based on the manifest value, if any.
43 if (manifest.display != blink::WebDisplayModeUndefined)
44 display = manifest.display;
46 // 'fullscreen' and 'minimal-ui' are not yet supported, fallback to the right
47 // mode in those cases.
48 if (manifest.display == blink::WebDisplayModeFullscreen)
49 display = blink::WebDisplayModeStandalone;
50 if (manifest.display == blink::WebDisplayModeMinimalUi)
51 display = blink::WebDisplayModeBrowser;
53 // Set the orientation based on the manifest value, if any.
54 if (manifest.orientation != blink::WebScreenOrientationLockDefault) {
55 // Ignore the orientation if the display mode is different from
56 // 'standalone'.
57 // TODO(mlamouri): send a message to the developer console about this.
58 if (display == blink::WebDisplayModeStandalone)
59 orientation = manifest.orientation;
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;
67 void ShortcutInfo::UpdateSource(const Source new_source) {
68 source = new_source;