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: content/public/common/manifest_util.cc

Issue 2221823002: Send orientation and display mode from Web Manifest to WebAPK server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_builder_impl22 Created 4 years, 4 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 | « content/public/common/manifest_util.h ('k') | content/renderer/manifest/manifest_parser.cc » ('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 2016 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 "content/public/common/manifest_util.h"
6
7 #include "base/strings/string_util.h"
8
9 namespace content {
10
11 std::string WebDisplayModeToString(blink::WebDisplayMode display) {
12 switch (display) {
13 case blink::WebDisplayModeUndefined:
14 return "";
15 case blink::WebDisplayModeBrowser:
16 return "browser";
17 case blink::WebDisplayModeMinimalUi:
18 return "minimal-ui";
19 case blink::WebDisplayModeStandalone:
20 return "standalone";
21 case blink::WebDisplayModeFullscreen:
22 return "fullscreen";
23 }
24 return "";
25 }
26
27 blink::WebDisplayMode WebDisplayModeFromString(const std::string& display) {
28 if (base::LowerCaseEqualsASCII(display, "browser"))
29 return blink::WebDisplayModeBrowser;
30 else if (base::LowerCaseEqualsASCII(display, "minimal-ui"))
31 return blink::WebDisplayModeMinimalUi;
32 else if (base::LowerCaseEqualsASCII(display, "standalone"))
33 return blink::WebDisplayModeStandalone;
34 else if (base::LowerCaseEqualsASCII(display, "fullscreen"))
35 return blink::WebDisplayModeFullscreen;
36 return blink::WebDisplayModeUndefined;
37 }
38
39 std::string WebScreenOrientationLockTypeToString(
40 blink::WebScreenOrientationLockType orientation) {
41 switch (orientation) {
42 case blink::WebScreenOrientationLockDefault:
43 return "";
44 case blink::WebScreenOrientationLockPortraitPrimary:
45 return "portrait-primary";
46 case blink::WebScreenOrientationLockPortraitSecondary:
47 return "portrait-secondary";
48 case blink::WebScreenOrientationLockLandscapePrimary:
49 return "landscape-primary";
50 case blink::WebScreenOrientationLockLandscapeSecondary:
51 return "landscape-secondary";
52 case blink::WebScreenOrientationLockAny:
53 return "any";
54 case blink::WebScreenOrientationLockLandscape:
55 return "landscape";
56 case blink::WebScreenOrientationLockPortrait:
57 return "portrait";
58 case blink::WebScreenOrientationLockNatural:
59 return "natural";
60 }
61 return "";
62 }
63
64 blink::WebScreenOrientationLockType
65 WebScreenOrientationLockTypeFromString(const std::string& orientation) {
66 if (base::LowerCaseEqualsASCII(orientation, "portrait-primary"))
67 return blink::WebScreenOrientationLockPortraitPrimary;
68 else if (base::LowerCaseEqualsASCII(orientation, "portrait-secondary"))
69 return blink::WebScreenOrientationLockPortraitSecondary;
70 else if (base::LowerCaseEqualsASCII(orientation, "landscape-primary"))
71 return blink::WebScreenOrientationLockLandscapePrimary;
72 else if (base::LowerCaseEqualsASCII(orientation, "landscape-secondary"))
73 return blink::WebScreenOrientationLockLandscapeSecondary;
74 else if (base::LowerCaseEqualsASCII(orientation, "any"))
75 return blink::WebScreenOrientationLockAny;
76 else if (base::LowerCaseEqualsASCII(orientation, "landscape"))
77 return blink::WebScreenOrientationLockLandscape;
78 else if (base::LowerCaseEqualsASCII(orientation, "portrait"))
79 return blink::WebScreenOrientationLockPortrait;
80 else if (base::LowerCaseEqualsASCII(orientation, "natural"))
81 return blink::WebScreenOrientationLockNatural;
82 return blink::WebScreenOrientationLockDefault;
83 }
84
85 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/manifest_util.h ('k') | content/renderer/manifest/manifest_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698