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

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

Issue 409603003: Refactor GuestView construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 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 CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
7 7
8 #include "base/bind.h"
8 #include "chrome/browser/guest_view/guest_view_base.h" 9 #include "chrome/browser/guest_view/guest_view_base.h"
9 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
10 11
11 // A GuestView is the templated base class for out-of-process frames in the 12 // A GuestView is the templated base class for out-of-process frames in the
12 // chrome layer. GuestView is templated on its derived type to allow for type- 13 // chrome layer. GuestView is templated on its derived type to allow for type-
13 // safe access. See GuestViewBase for more information. 14 // safe access. See GuestViewBase for more information.
14 template <typename T> 15 template <typename T>
15 class GuestView : public GuestViewBase { 16 class GuestView : public GuestViewBase {
16 public: 17 public:
18 static void Register() {
19 GuestViewBase::RegisterGuestViewType(T::Type, base::Bind(&T::Create));
20 }
21
17 static T* From(int embedder_process_id, int guest_instance_id) { 22 static T* From(int embedder_process_id, int guest_instance_id) {
18 GuestViewBase* guest = 23 GuestViewBase* guest =
19 GuestViewBase::From(embedder_process_id, guest_instance_id); 24 GuestViewBase::From(embedder_process_id, guest_instance_id);
20 if (!guest) 25 if (!guest)
21 return NULL; 26 return NULL;
22 return guest->As<T>(); 27 return guest->As<T>();
23 } 28 }
24 29
25 static T* FromWebContents(content::WebContents* contents) { 30 static T* FromWebContents(content::WebContents* contents) {
26 GuestViewBase* guest = GuestViewBase::FromWebContents(contents); 31 GuestViewBase* guest = GuestViewBase::FromWebContents(contents);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 GuestView(content::BrowserContext* browser_context, 63 GuestView(content::BrowserContext* browser_context,
59 int guest_instance_id) 64 int guest_instance_id)
60 : GuestViewBase(browser_context, guest_instance_id) {} 65 : GuestViewBase(browser_context, guest_instance_id) {}
61 virtual ~GuestView() {} 66 virtual ~GuestView() {}
62 67
63 private: 68 private:
64 DISALLOW_COPY_AND_ASSIGN(GuestView); 69 DISALLOW_COPY_AND_ASSIGN(GuestView);
65 }; 70 };
66 71
67 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ 72 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/app_view/app_view_guest.cc ('k') | chrome/browser/guest_view/guest_view_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698