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

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

Issue 899543003: Break out more manifest parsing logic from ShortcutHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 5 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
« no previous file with comments | « chrome/browser/android/shortcut_info.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 ShortcutInfo::ShortcutInfo()
8 : display(content::Manifest::DISPLAY_MODE_BROWSER),
9 orientation(blink::WebScreenOrientationLockDefault) {
10 }
11
12 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url)
13 : url(shortcut_url),
14 display(content::Manifest::DISPLAY_MODE_BROWSER),
15 orientation(blink::WebScreenOrientationLockDefault) {
16 }
17
18 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) {
19 if (!manifest.short_name.is_null())
20 title = manifest.short_name.string();
21 else if (!manifest.name.is_null())
22 title = manifest.name.string();
23
24 // Set the url based on the manifest value, if any.
25 if (manifest.start_url.is_valid())
26 url = manifest.start_url;
27
28 // Set the display based on the manifest value, if any.
29 if (manifest.display != content::Manifest::DISPLAY_MODE_UNSPECIFIED)
30 display = manifest.display;
31
32 // 'fullscreen' and 'minimal-ui' are not yet supported, fallback to the right
33 // mode in those cases.
34 if (manifest.display == content::Manifest::DISPLAY_MODE_FULLSCREEN)
35 display = content::Manifest::DISPLAY_MODE_STANDALONE;
36 if (manifest.display == content::Manifest::DISPLAY_MODE_MINIMAL_UI)
37 display = content::Manifest::DISPLAY_MODE_BROWSER;
38
39 // Set the orientation based on the manifest value, if any.
40 if (manifest.orientation != blink::WebScreenOrientationLockDefault) {
41 // Ignore the orientation if the display mode is different from
42 // 'standalone'.
43 // TODO(mlamouri): send a message to the developer console about this.
44 if (display == content::Manifest::DISPLAY_MODE_STANDALONE)
45 orientation = manifest.orientation;
46 }
47 }
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_info.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698