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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/shortcut_info.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/shortcut_info.cc
diff --git a/chrome/browser/android/shortcut_info.cc b/chrome/browser/android/shortcut_info.cc
new file mode 100644
index 0000000000000000000000000000000000000000..24406b889b509c0ea2166e59a1eb8abb2dc9977f
--- /dev/null
+++ b/chrome/browser/android/shortcut_info.cc
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/shortcut_info.h"
+
+ShortcutInfo::ShortcutInfo()
+ : display(content::Manifest::DISPLAY_MODE_BROWSER),
+ orientation(blink::WebScreenOrientationLockDefault) {
+}
+
+ShortcutInfo::ShortcutInfo(const GURL& shortcut_url)
+ : url(shortcut_url),
+ display(content::Manifest::DISPLAY_MODE_BROWSER),
+ orientation(blink::WebScreenOrientationLockDefault) {
+}
+
+void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) {
+ if (!manifest.short_name.is_null())
+ title = manifest.short_name.string();
+ else if (!manifest.name.is_null())
+ title = manifest.name.string();
+
+ // Set the url based on the manifest value, if any.
+ if (manifest.start_url.is_valid())
+ url = manifest.start_url;
+
+ // Set the display based on the manifest value, if any.
+ if (manifest.display != content::Manifest::DISPLAY_MODE_UNSPECIFIED)
+ display = manifest.display;
+
+ // 'fullscreen' and 'minimal-ui' are not yet supported, fallback to the right
+ // mode in those cases.
+ if (manifest.display == content::Manifest::DISPLAY_MODE_FULLSCREEN)
+ display = content::Manifest::DISPLAY_MODE_STANDALONE;
+ if (manifest.display == content::Manifest::DISPLAY_MODE_MINIMAL_UI)
+ display = content::Manifest::DISPLAY_MODE_BROWSER;
+
+ // Set the orientation based on the manifest value, if any.
+ if (manifest.orientation != blink::WebScreenOrientationLockDefault) {
+ // Ignore the orientation if the display mode is different from
+ // 'standalone'.
+ // TODO(mlamouri): send a message to the developer console about this.
+ if (display == content::Manifest::DISPLAY_MODE_STANDALONE)
+ orientation = manifest.orientation;
+ }
+}
« 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