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

Side by Side Diff: content/public/common/manifest_util.cc

Issue 2138973002: Initial CL for talking to the WebAPK server to generate WebAPK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_builder_impl2 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
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"
mlamouri (slow - plz ping) 2016/08/04 13:04:26 Why do you need this?
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 }
25
26 blink::WebDisplayMode WebDisplayModeFromString(const std::string& display) {
27 if (display == "browser")
mlamouri (slow - plz ping) 2016/08/04 13:04:26 Maybe add a DCHECK() enforcing that |display| is l
pkotwicz 2016/08/04 15:42:45 I have changed this function to be case insensitiv
28 return blink::WebDisplayModeBrowser;
29 else if (display == "minimal-ui")
30 return blink::WebDisplayModeMinimalUi;
31 else if (display == "standalone")
32 return blink::WebDisplayModeStandalone;
33 else if (display == "fullscreen")
34 return blink::WebDisplayModeFullscreen;
35 else
mlamouri (slow - plz ping) 2016/08/04 13:04:26 scratch the `else` here
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 }
62
63 blink::WebScreenOrientationLockType
64 WebScreenOrientationLockTypeFromString(const std::string& orientation) {
65 if (orientation == "portrait-primary")
mlamouri (slow - plz ping) 2016/08/04 13:04:26 As above, maybe add a DCHECK?
pkotwicz 2016/08/04 15:42:45 I have changed this function to be case insensitiv
66 return blink::WebScreenOrientationLockPortraitPrimary;
67 else if (orientation == "portrait-secondary")
68 return blink::WebScreenOrientationLockPortraitSecondary;
69 else if (orientation == "landscape-primary")
70 return blink::WebScreenOrientationLockLandscapePrimary;
71 else if (orientation == "landscape-secondary")
72 return blink::WebScreenOrientationLockLandscapeSecondary;
73 else if (orientation == "any")
74 return blink::WebScreenOrientationLockAny;
75 else if (orientation == "landscape")
76 return blink::WebScreenOrientationLockLandscape;
77 else if (orientation == "portrait")
78 return blink::WebScreenOrientationLockPortrait;
79 else if (orientation == "natural")
80 return blink::WebScreenOrientationLockNatural;
81 return blink::WebScreenOrientationLockDefault;
82 }
83
84 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698