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

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

Issue 1234653004: webapps: utilize manifest theme colors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mounir's comments Created 5 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/shortcut_info.h" 5 #include "chrome/browser/android/shortcut_info.h"
6 6
7 ShortcutInfo::ShortcutInfo() 7 ShortcutInfo::ShortcutInfo()
8 : display(content::Manifest::DISPLAY_MODE_BROWSER), 8 : display(content::Manifest::DISPLAY_MODE_BROWSER),
9 orientation(blink::WebScreenOrientationLockDefault), 9 orientation(blink::WebScreenOrientationLockDefault),
10 theme_color(content::Manifest::kInvalidOrMissingThemeColor),
10 source(SOURCE_ADD_TO_HOMESCREEN) { 11 source(SOURCE_ADD_TO_HOMESCREEN) {
11 } 12 }
12 13
13 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url) 14 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url)
14 : url(shortcut_url), 15 : url(shortcut_url),
15 display(content::Manifest::DISPLAY_MODE_BROWSER), 16 display(content::Manifest::DISPLAY_MODE_BROWSER),
16 orientation(blink::WebScreenOrientationLockDefault), 17 orientation(blink::WebScreenOrientationLockDefault),
18 theme_color(content::Manifest::kInvalidOrMissingThemeColor),
mlamouri (slow - plz ping) 2015/07/20 13:29:45 I think you can try to use a C++11 new feature: de
Lalit Maganti 2015/07/20 13:56:13 Done.
Bernhard Bauer 2015/07/20 17:11:35 Is it?
Lalit Maganti 2015/07/20 17:17:04 I did try it but since Android uses GCC and not Cl
Bernhard Bauer 2015/08/11 09:40:47 :( OTOH, the style guide actually does allow defa
17 source(SOURCE_ADD_TO_HOMESCREEN) { 19 source(SOURCE_ADD_TO_HOMESCREEN) {
18 } 20 }
19 21
20 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { 22 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) {
21 if (!manifest.short_name.is_null()) 23 if (!manifest.short_name.is_null())
22 title = manifest.short_name.string(); 24 title = manifest.short_name.string();
23 else if (!manifest.name.is_null()) 25 else if (!manifest.name.is_null())
24 title = manifest.name.string(); 26 title = manifest.name.string();
25 27
26 // Set the url based on the manifest value, if any. 28 // Set the url based on the manifest value, if any.
(...skipping 12 matching lines...) Expand all
39 display = content::Manifest::DISPLAY_MODE_BROWSER; 41 display = content::Manifest::DISPLAY_MODE_BROWSER;
40 42
41 // Set the orientation based on the manifest value, if any. 43 // Set the orientation based on the manifest value, if any.
42 if (manifest.orientation != blink::WebScreenOrientationLockDefault) { 44 if (manifest.orientation != blink::WebScreenOrientationLockDefault) {
43 // Ignore the orientation if the display mode is different from 45 // Ignore the orientation if the display mode is different from
44 // 'standalone'. 46 // 'standalone'.
45 // TODO(mlamouri): send a message to the developer console about this. 47 // TODO(mlamouri): send a message to the developer console about this.
46 if (display == content::Manifest::DISPLAY_MODE_STANDALONE) 48 if (display == content::Manifest::DISPLAY_MODE_STANDALONE)
47 orientation = manifest.orientation; 49 orientation = manifest.orientation;
48 } 50 }
51
52 // Set the theme color based on the manifest value, if any
mlamouri (slow - plz ping) 2015/07/20 13:29:45 nit: finish the sentence with a period.
Lalit Maganti 2015/07/20 13:56:13 Done.
53 if (manifest.theme_color != content::Manifest::kInvalidOrMissingThemeColor)
54 theme_color = manifest.theme_color;
49 } 55 }
50 56
51 void ShortcutInfo::UpdateSource(const Source new_source) { 57 void ShortcutInfo::UpdateSource(const Source new_source) {
52 source = new_source; 58 source = new_source;
53 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698