OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "chrome/browser/android/shortcut_info.h" | |
6 | |
7 #include "base/strings/string16.h" | |
8 #include "content/public/common/manifest.h" | |
9 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" | |
10 #include "url/gurl.h" | |
mlamouri (slow - plz ping)
2015/02/03 17:40:24
You probably don't need those #include, they are i
gone
2015/02/03 19:48:23
Done.
| |
11 | |
12 ShortcutInfo::ShortcutInfo() | |
13 : display(content::Manifest::DISPLAY_MODE_BROWSER), | |
14 orientation(blink::WebScreenOrientationLockDefault) { | |
15 } | |
16 | |
17 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url) | |
18 : url(shortcut_url), | |
19 display(content::Manifest::DISPLAY_MODE_BROWSER), | |
20 orientation(blink::WebScreenOrientationLockDefault) { | |
21 } | |
22 | |
23 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { | |
24 if (!manifest.short_name.is_null()) | |
25 title = manifest.short_name.string(); | |
26 else if (!manifest.name.is_null()) | |
27 title = manifest.name.string(); | |
28 | |
29 // Set the url based on the manifest value, if any. | |
30 if (manifest.start_url.is_valid()) | |
31 url = manifest.start_url; | |
32 | |
33 // Set the display based on the manifest value, if any. | |
34 if (manifest.display != content::Manifest::DISPLAY_MODE_UNSPECIFIED) | |
35 display = manifest.display; | |
36 | |
37 // 'fullscreen' and 'minimal-ui' are not yet supported, fallback to the right | |
38 // mode in those cases. | |
39 if (manifest.display == content::Manifest::DISPLAY_MODE_FULLSCREEN) | |
40 display = content::Manifest::DISPLAY_MODE_STANDALONE; | |
41 if (manifest.display == content::Manifest::DISPLAY_MODE_MINIMAL_UI) | |
42 display = content::Manifest::DISPLAY_MODE_BROWSER; | |
43 | |
44 // Set the orientation based on the manifest value, if any. | |
45 if (manifest.orientation != blink::WebScreenOrientationLockDefault) { | |
46 // Ignore the orientation if the display mode is different from | |
47 // 'standalone'. | |
48 // TODO(mlamouri): send a message to the developer console about this. | |
49 if (display == content::Manifest::DISPLAY_MODE_STANDALONE) | |
50 orientation = manifest.orientation; | |
51 } | |
52 } | |
OLD | NEW |