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

Unified Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 314853003: Move GuestViewBase::GetGuestPartitionConfigForSite to WebViewGuest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/guest_view/web_view/web_view_guest.cc
diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc
index 7aea60478e1d16b6718e7dab5bde1301ba49dd60..ca19926045ac2e8985011d388529efd2d0e582cc 100644
--- a/chrome/browser/guest_view/web_view/web_view_guest.cc
+++ b/chrome/browser/guest_view/web_view/web_view_guest.cc
@@ -48,6 +48,7 @@
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "ipc/ipc_message_macros.h"
+#include "net/base/escape.h"
#include "net/base/net_errors.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "ui/base/models/simple_menu_model.h"
@@ -210,9 +211,32 @@ WebViewGuest::WebViewGuest(int guest_instance_id,
}
// static
+bool WebViewGuest::GetGuestPartitionConfigForSite(
+ const GURL& site,
+ std::string* partition_domain,
+ std::string* partition_name,
+ bool* in_memory) {
+ if (!site.SchemeIs(content::kGuestScheme))
+ return false;
+
+ // Since guest URLs are only used for packaged apps, there must be an app
+ // id in the URL.
+ CHECK(site.has_host());
+ *partition_domain = site.host();
+ // Since persistence is optional, the path must either be empty or the
+ // literal string.
+ *in_memory = (site.path() != "/persist");
+ // The partition name is user supplied value, which we have encoded when the
+ // URL was created, so it needs to be decoded.
+ *partition_name =
+ net::UnescapeURLComponent(site.query(), net::UnescapeRule::NORMAL);
+ return true;
+}
+
+// static
const char WebViewGuest::Type[] = "webview";
-// static.
+// static
int WebViewGuest::GetViewInstanceId(WebContents* contents) {
WebViewGuest* guest = FromWebContents(contents);
if (!guest)
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698