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

Unified Diff: chrome/browser/guestview/webview/webview_guest.cc

Issue 237533008: Refactor GuestView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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: chrome/browser/guestview/webview/webview_guest.cc
diff --git a/chrome/browser/guestview/webview/webview_guest.cc b/chrome/browser/guestview/webview/webview_guest.cc
index fc82fbbe3e9996565e6133f8617233d06cab346d..9bac8258058cf6921142726eca5a4683b466cbb9 100644
--- a/chrome/browser/guestview/webview/webview_guest.cc
+++ b/chrome/browser/guestview/webview/webview_guest.cc
@@ -164,13 +164,13 @@ WebViewGuest* WebViewGuest::From(int embedder_process_id,
GuestView* guest = GuestView::From(embedder_process_id, guest_instance_id);
if (!guest)
return NULL;
- return guest->AsWebView();
+ return guest->As<WebViewGuest>();
}
// static
WebViewGuest* WebViewGuest::FromWebContents(WebContents* contents) {
GuestView* guest = GuestView::FromWebContents(contents);
- return guest ? guest->AsWebView() : NULL;
+ return guest ? guest->As<WebViewGuest>() : NULL;
}
// static.
@@ -183,6 +183,9 @@ int WebViewGuest::GetViewInstanceId(WebContents* contents) {
}
// static
+GuestView::Type WebViewGuest::Type() { return GuestView::WEBVIEW; }
+
+// static
void WebViewGuest::RecordUserInitiatedUMA(const PermissionResponseInfo& info,
bool allow) {
if (allow) {
@@ -289,17 +292,7 @@ void WebViewGuest::Attach(WebContents* embedder_web_contents,
AddWebViewToExtensionRendererState();
}
-GuestView::Type WebViewGuest::GetViewType() const {
- return GuestView::WEBVIEW;
-}
-
-WebViewGuest* WebViewGuest::AsWebView() {
- return this;
-}
-
-AdViewGuest* WebViewGuest::AsAdView() {
- return NULL;
-}
+GuestView::Type WebViewGuest::GetViewType() const { return Type(); }
Fady Samuel 2014/04/16 02:47:44 I've been thinking. We can probably move GetViewTy
Xi Han 2014/04/16 13:33:32 Does it worth to introduce another layer just for
Xi Han 2014/04/16 17:42:19 As discussed offline, I will introduce a template
void WebViewGuest::AddMessageToConsole(int32 level,
const base::string16& message,
« chrome/browser/guestview/guestview.h ('K') | « chrome/browser/guestview/webview/webview_guest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698