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

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

Issue 1224273003: webapps: propogate name and shortName from manifest to Java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add back explict destructor 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
« no previous file with comments | « chrome/browser/android/shortcut_info.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 source(SOURCE_ADD_TO_HOMESCREEN) { 10 source(SOURCE_ADD_TO_HOMESCREEN) {
11 } 11 }
12 12
13 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url) 13 ShortcutInfo::ShortcutInfo(const GURL& shortcut_url)
14 : url(shortcut_url), 14 : url(shortcut_url),
15 display(content::Manifest::DISPLAY_MODE_BROWSER), 15 display(content::Manifest::DISPLAY_MODE_BROWSER),
16 orientation(blink::WebScreenOrientationLockDefault), 16 orientation(blink::WebScreenOrientationLockDefault),
17 source(SOURCE_ADD_TO_HOMESCREEN) { 17 source(SOURCE_ADD_TO_HOMESCREEN) {
18 } 18 }
19 19
20 ShortcutInfo::~ShortcutInfo() {
21 }
22
20 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { 23 void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) {
21 if (!manifest.short_name.is_null()) 24 if (!manifest.short_name.is_null())
22 title = manifest.short_name.string(); 25 short_name = manifest.short_name.string();
23 else if (!manifest.name.is_null()) 26 if (!manifest.name.is_null())
24 title = manifest.name.string(); 27 name = manifest.name.string();
28 if (manifest.short_name.is_null() != manifest.name.is_null()) {
29 if (manifest.short_name.is_null())
30 short_name = name;
31 name = short_name;
32 }
33 if (!short_name.empty())
34 user_title = short_name;
25 35
26 // Set the url based on the manifest value, if any. 36 // Set the url based on the manifest value, if any.
27 if (manifest.start_url.is_valid()) 37 if (manifest.start_url.is_valid())
28 url = manifest.start_url; 38 url = manifest.start_url;
29 39
30 // Set the display based on the manifest value, if any. 40 // Set the display based on the manifest value, if any.
31 if (manifest.display != content::Manifest::DISPLAY_MODE_UNSPECIFIED) 41 if (manifest.display != content::Manifest::DISPLAY_MODE_UNSPECIFIED)
32 display = manifest.display; 42 display = manifest.display;
33 43
34 // 'fullscreen' and 'minimal-ui' are not yet supported, fallback to the right 44 // 'fullscreen' and 'minimal-ui' are not yet supported, fallback to the right
35 // mode in those cases. 45 // mode in those cases.
36 if (manifest.display == content::Manifest::DISPLAY_MODE_FULLSCREEN) 46 if (manifest.display == content::Manifest::DISPLAY_MODE_FULLSCREEN)
37 display = content::Manifest::DISPLAY_MODE_STANDALONE; 47 display = content::Manifest::DISPLAY_MODE_STANDALONE;
38 if (manifest.display == content::Manifest::DISPLAY_MODE_MINIMAL_UI) 48 if (manifest.display == content::Manifest::DISPLAY_MODE_MINIMAL_UI)
39 display = content::Manifest::DISPLAY_MODE_BROWSER; 49 display = content::Manifest::DISPLAY_MODE_BROWSER;
40 50
41 // Set the orientation based on the manifest value, if any. 51 // Set the orientation based on the manifest value, if any.
42 if (manifest.orientation != blink::WebScreenOrientationLockDefault) { 52 if (manifest.orientation != blink::WebScreenOrientationLockDefault) {
43 // Ignore the orientation if the display mode is different from 53 // Ignore the orientation if the display mode is different from
44 // 'standalone'. 54 // 'standalone'.
45 // TODO(mlamouri): send a message to the developer console about this. 55 // TODO(mlamouri): send a message to the developer console about this.
46 if (display == content::Manifest::DISPLAY_MODE_STANDALONE) 56 if (display == content::Manifest::DISPLAY_MODE_STANDALONE)
47 orientation = manifest.orientation; 57 orientation = manifest.orientation;
48 } 58 }
49 } 59 }
50 60
51 void ShortcutInfo::UpdateSource(const Source new_source) { 61 void ShortcutInfo::UpdateSource(const Source new_source) {
52 source = new_source; 62 source = new_source;
53 } 63 }
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698