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

Side by Side Diff: extensions/browser/guest_view/guest_view.h

Issue 1096623002: Moved guest_view_registry to GuestViewManager and made it an instance map (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@switch_to_frombrowsercontextifavailable
Patch Set: Addressed comments Created 5 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
« no previous file with comments | « no previous file | extensions/browser/guest_view/guest_view_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
7 7
8 #include "base/bind.h"
9 #include "content/public/browser/render_frame_host.h" 8 #include "content/public/browser/render_frame_host.h"
10 #include "extensions/browser/guest_view/guest_view_base.h" 9 #include "extensions/browser/guest_view/guest_view_base.h"
10 #include "extensions/browser/guest_view/guest_view_manager.h"
11 11
12 namespace extensions { 12 namespace extensions {
13 13
14 // A GuestView is the templated base class for out-of-process frames in the 14 // A GuestView is the templated base class for out-of-process frames in the
15 // chrome layer. GuestView is templated on its derived type to allow for type- 15 // chrome layer. GuestView is templated on its derived type to allow for type-
16 // safe access. See GuestViewBase for more information. 16 // safe access. See GuestViewBase for more information.
17 template <typename T> 17 template <typename T>
18 class GuestView : public GuestViewBase { 18 class GuestView : public GuestViewBase {
19 public: 19 public:
20 static void Register() {
21 GuestViewBase::RegisterGuestViewType(T::Type, base::Bind(&T::Create));
22 }
23
24 static T* From(int embedder_process_id, int guest_instance_id) { 20 static T* From(int embedder_process_id, int guest_instance_id) {
25 auto guest = GuestViewBase::From(embedder_process_id, guest_instance_id); 21 auto guest = GuestViewBase::From(embedder_process_id, guest_instance_id);
26 if (!guest) 22 if (!guest)
27 return nullptr; 23 return nullptr;
28 return guest->As<T>(); 24 return guest->As<T>();
29 } 25 }
30 26
31 static T* FromWebContents(const content::WebContents* contents) { 27 static T* FromWebContents(const content::WebContents* contents) {
32 auto guest = GuestViewBase::FromWebContents(contents); 28 auto guest = GuestViewBase::FromWebContents(contents);
33 return guest ? guest->As<T>() : nullptr; 29 return guest ? guest->As<T>() : nullptr;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 : GuestViewBase(owner_web_contents) {} 61 : GuestViewBase(owner_web_contents) {}
66 ~GuestView() override {} 62 ~GuestView() override {}
67 63
68 private: 64 private:
69 DISALLOW_COPY_AND_ASSIGN(GuestView); 65 DISALLOW_COPY_AND_ASSIGN(GuestView);
70 }; 66 };
71 67
72 } // namespace extensions 68 } // namespace extensions
73 69
74 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ 70 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/guest_view/guest_view_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698