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

Side by Side Diff: chrome/browser/guestview/webview/webview_guest.h

Issue 237533008: Refactor GuestView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduce template class GuestView. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 5 #ifndef CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
6 #define CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 6 #define CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
7 7
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "chrome/browser/extensions/tab_helper.h" 9 #include "chrome/browser/extensions/tab_helper.h"
10 #include "chrome/browser/guestview/guestview.h" 10 #include "chrome/browser/guestview/guestview.h"
(...skipping 13 matching lines...) Expand all
24 class WebviewFindFunction; 24 class WebviewFindFunction;
25 } // namespace extensions 25 } // namespace extensions
26 26
27 // A WebViewGuest is a WebContentsObserver on the guest WebContents of a 27 // A WebViewGuest is a WebContentsObserver on the guest WebContents of a
28 // <webview> tag. It provides the browser-side implementation of the <webview> 28 // <webview> tag. It provides the browser-side implementation of the <webview>
29 // API and manages the lifetime of <webview> extension events. WebViewGuest is 29 // API and manages the lifetime of <webview> extension events. WebViewGuest is
30 // created on attachment. That is, when a guest WebContents is associated with 30 // created on attachment. That is, when a guest WebContents is associated with
31 // a particular embedder WebContents. This happens on either initial navigation 31 // a particular embedder WebContents. This happens on either initial navigation
32 // or through the use of the New Window API, when a new window is attached to 32 // or through the use of the New Window API, when a new window is attached to
33 // a particular <webview>. 33 // a particular <webview>.
34 class WebViewGuest : public GuestView, 34 class WebViewGuest : public GuestView<WebViewGuest>,
35 public content::NotificationObserver, 35 public content::NotificationObserver,
36 public content::WebContentsObserver { 36 public content::WebContentsObserver {
37 public: 37 public:
38 WebViewGuest(content::WebContents* guest_web_contents, 38 WebViewGuest(content::WebContents* guest_web_contents,
39 const std::string& embedder_extension_id); 39 const std::string& embedder_extension_id);
40 40
41 static WebViewGuest* From(int embedder_process_id, int instance_id);
42 static WebViewGuest* FromWebContents(content::WebContents* contents);
43 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a 41 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a
44 // WebViewGuest. 42 // WebViewGuest.
45 static int GetViewInstanceId(content::WebContents* contents); 43 static int GetViewInstanceId(content::WebContents* contents);
44 static const std::string& Type;
46 45
47 // GuestView implementation. 46 // GuestViewBase implementation.
48 virtual void Attach(content::WebContents* embedder_web_contents, 47 virtual void Attach(content::WebContents* embedder_web_contents,
49 const base::DictionaryValue& args) OVERRIDE; 48 const base::DictionaryValue& args) OVERRIDE;
50 virtual GuestView::Type GetViewType() const OVERRIDE;
51 virtual WebViewGuest* AsWebView() OVERRIDE;
52 virtual AdViewGuest* AsAdView() OVERRIDE;
53 49
54 // GuestDelegate implementation. 50 // GuestDelegate implementation.
55 virtual void AddMessageToConsole(int32 level, 51 virtual void AddMessageToConsole(int32 level,
56 const base::string16& message, 52 const base::string16& message,
57 int32 line_no, 53 int32 line_no,
58 const base::string16& source_id) OVERRIDE; 54 const base::string16& source_id) OVERRIDE;
59 virtual void LoadProgressed(double progress) OVERRIDE; 55 virtual void LoadProgressed(double progress) OVERRIDE;
60 virtual void Close() OVERRIDE; 56 virtual void Close() OVERRIDE;
61 virtual void DidAttach() OVERRIDE; 57 virtual void DidAttach() OVERRIDE;
62 virtual void EmbedderDestroyed() OVERRIDE; 58 virtual void EmbedderDestroyed() OVERRIDE;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 scoped_ptr<chromeos::AccessibilityStatusSubscription> 314 scoped_ptr<chromeos::AccessibilityStatusSubscription>
319 accessibility_subscription_; 315 accessibility_subscription_;
320 #endif 316 #endif
321 317
322 std::map<int, int> bridge_id_to_request_id_map_; 318 std::map<int, int> bridge_id_to_request_id_map_;
323 319
324 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); 320 DISALLOW_COPY_AND_ASSIGN(WebViewGuest);
325 }; 321 };
326 322
327 #endif // CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 323 #endif // CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698