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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/public/common/manifest_util.cc
diff --git a/content/public/common/manifest_util.cc b/content/public/common/manifest_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..07d276bbd9ec38fd414ef98c5f49c256eff54c41
--- /dev/null
+++ b/content/public/common/manifest_util.cc
@@ -0,0 +1,84 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/common/manifest_util.h"
+
+#include "base/strings/string_util.h"
mlamouri (slow - plz ping) 2016/08/04 13:04:26 Why do you need this?
+
+namespace content {
+
+std::string WebDisplayModeToString(blink::WebDisplayMode display) {
+ switch (display) {
+ case blink::WebDisplayModeUndefined:
+ return "";
+ case blink::WebDisplayModeBrowser:
+ return "browser";
+ case blink::WebDisplayModeMinimalUi:
+ return "minimal-ui";
+ case blink::WebDisplayModeStandalone:
+ return "standalone";
+ case blink::WebDisplayModeFullscreen:
+ return "fullscreen";
+ }
+}
+
+blink::WebDisplayMode WebDisplayModeFromString(const std::string& display) {
+ 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
+ return blink::WebDisplayModeBrowser;
+ else if (display == "minimal-ui")
+ return blink::WebDisplayModeMinimalUi;
+ else if (display == "standalone")
+ return blink::WebDisplayModeStandalone;
+ else if (display == "fullscreen")
+ return blink::WebDisplayModeFullscreen;
+ else
mlamouri (slow - plz ping) 2016/08/04 13:04:26 scratch the `else` here
+ return blink::WebDisplayModeUndefined;
+}
+
+std::string WebScreenOrientationLockTypeToString(
+ blink::WebScreenOrientationLockType orientation) {
+ switch (orientation) {
+ case blink::WebScreenOrientationLockDefault:
+ return "";
+ case blink::WebScreenOrientationLockPortraitPrimary:
+ return "portrait-primary";
+ case blink::WebScreenOrientationLockPortraitSecondary:
+ return "portrait-secondary";
+ case blink::WebScreenOrientationLockLandscapePrimary:
+ return "landscape-primary";
+ case blink::WebScreenOrientationLockLandscapeSecondary:
+ return "landscape-secondary";
+ case blink::WebScreenOrientationLockAny:
+ return "any";
+ case blink::WebScreenOrientationLockLandscape:
+ return "landscape";
+ case blink::WebScreenOrientationLockPortrait:
+ return "portrait";
+ case blink::WebScreenOrientationLockNatural:
+ return "natural";
+ }
+}
+
+blink::WebScreenOrientationLockType
+WebScreenOrientationLockTypeFromString(const std::string& orientation) {
+ 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
+ return blink::WebScreenOrientationLockPortraitPrimary;
+ else if (orientation == "portrait-secondary")
+ return blink::WebScreenOrientationLockPortraitSecondary;
+ else if (orientation == "landscape-primary")
+ return blink::WebScreenOrientationLockLandscapePrimary;
+ else if (orientation == "landscape-secondary")
+ return blink::WebScreenOrientationLockLandscapeSecondary;
+ else if (orientation == "any")
+ return blink::WebScreenOrientationLockAny;
+ else if (orientation == "landscape")
+ return blink::WebScreenOrientationLockLandscape;
+ else if (orientation == "portrait")
+ return blink::WebScreenOrientationLockPortrait;
+ else if (orientation == "natural")
+ return blink::WebScreenOrientationLockNatural;
+ return blink::WebScreenOrientationLockDefault;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698