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

Unified Diff: chrome/browser/android/shortcut_helper.cc

Issue 579883002: Use Manifest's orientation when creating a shortcut and as default orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use_display_in_shortcuthelper
Patch Set: review comments Created 6 years, 3 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
Index: chrome/browser/android/shortcut_helper.cc
diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc
index 9c858f9c9797850b8ffc7b604e7866a0a1d11c21..a485d40ec62cb6b12304e5e7130fc5b5da01f1d8 100644
--- a/chrome/browser/android/shortcut_helper.cc
+++ b/chrome/browser/android/shortcut_helper.cc
@@ -48,6 +48,7 @@ ShortcutHelper::ShortcutHelper(JNIEnv* env,
java_ref_(env, obj),
url_(web_contents->GetURL()),
display_(content::Manifest::DISPLAY_MODE_BROWSER),
+ orientation_(blink::WebScreenOrientationLockDefault),
weak_ptr_factory_(this) {
}
@@ -118,6 +119,15 @@ void ShortcutHelper::OnDidGetManifest(const content::Manifest& manifest) {
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;
+ }
+
// The ShortcutHelper is now able to notify its Java counterpart that it is
// initialized. OnInitialized method is not conceptually part of getting the
// manifest data but it happens that the initialization is finalized when
@@ -183,7 +193,8 @@ void ShortcutHelper::FinishAddingShortcut(
url_,
title_,
display_,
- icon_),
+ icon_,
+ orientation_),
true);
Destroy();
@@ -213,7 +224,8 @@ void ShortcutHelper::AddShortcutInBackground(
const GURL& url,
const base::string16& title,
content::Manifest::DisplayMode display,
- const favicon_base::FaviconRawBitmapResult& bitmap_result) {
+ const favicon_base::FaviconRawBitmapResult& bitmap_result,
+ blink::WebScreenOrientationLockType orientation) {
DCHECK(base::WorkerPool::RunsTasksOnCurrentThread());
// Grab the average color from the bitmap.
@@ -249,5 +261,6 @@ void ShortcutHelper::AddShortcutInBackground(
r_value,
g_value,
b_value,
- display == content::Manifest::DISPLAY_MODE_STANDALONE);
+ display == content::Manifest::DISPLAY_MODE_STANDALONE,
+ orientation);
}

Powered by Google App Engine
This is Rietveld 408576698