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

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

Issue 409133002: GuestView: Lazy registration and once for all profiles (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
« no previous file with comments | « no previous file | chrome/browser/guest_view/guest_view_base.cc » ('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 CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Returns a *ViewGuest if this GuestView is of the given view type. 46 // Returns a *ViewGuest if this GuestView is of the given view type.
47 template <typename T> 47 template <typename T>
48 T* As() { 48 T* As() {
49 if (IsViewType(T::Type)) 49 if (IsViewType(T::Type))
50 return static_cast<T*>(this); 50 return static_cast<T*>(this);
51 51
52 return NULL; 52 return NULL;
53 } 53 }
54 54
55 static void RegisterGuestViewTypes();
56
57 typedef base::Callback<GuestViewBase*( 55 typedef base::Callback<GuestViewBase*(
58 content::BrowserContext*, int)> GuestCreationCallback; 56 content::BrowserContext*, int)> GuestCreationCallback;
59 static void RegisterGuestViewType(const std::string& view_type, 57 static void RegisterGuestViewType(const std::string& view_type,
60 const GuestCreationCallback& callback); 58 const GuestCreationCallback& callback);
61 59
62 static GuestViewBase* Create(content::BrowserContext* browser_context, 60 static GuestViewBase* Create(content::BrowserContext* browser_context,
63 int guest_instance_id, 61 int guest_instance_id,
64 const std::string& view_type); 62 const std::string& view_type);
65 63
66 static GuestViewBase* FromWebContents(content::WebContents* web_contents); 64 static GuestViewBase* FromWebContents(content::WebContents* web_contents);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 private: 227 private:
230 class EmbedderWebContentsObserver; 228 class EmbedderWebContentsObserver;
231 229
232 void SendQueuedEvents(); 230 void SendQueuedEvents();
233 231
234 void CompleteInit(const std::string& embedder_extension_id, 232 void CompleteInit(const std::string& embedder_extension_id,
235 int embedder_render_process_id, 233 int embedder_render_process_id,
236 const WebContentsCreatedCallback& callback, 234 const WebContentsCreatedCallback& callback,
237 content::WebContents* guest_web_contents); 235 content::WebContents* guest_web_contents);
238 236
237 static void RegisterGuestViewTypes();
238
239 // WebContentsObserver implementation. 239 // WebContentsObserver implementation.
240 virtual void DidStopLoading( 240 virtual void DidStopLoading(
241 content::RenderViewHost* render_view_host) OVERRIDE FINAL; 241 content::RenderViewHost* render_view_host) OVERRIDE FINAL;
242 virtual void WebContentsDestroyed() OVERRIDE FINAL; 242 virtual void WebContentsDestroyed() OVERRIDE FINAL;
243 243
244 // WebContentsDelegate implementation. 244 // WebContentsDelegate implementation.
245 virtual bool ShouldFocusPageAfterCrash() OVERRIDE FINAL; 245 virtual bool ShouldFocusPageAfterCrash() OVERRIDE FINAL;
246 virtual bool PreHandleGestureEvent( 246 virtual bool PreHandleGestureEvent(
247 content::WebContents* source, 247 content::WebContents* source,
248 const blink::WebGestureEvent& event) OVERRIDE FINAL; 248 const blink::WebGestureEvent& event) OVERRIDE FINAL;
(...skipping 29 matching lines...) Expand all
278 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; 278 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_;
279 279
280 // This is used to ensure pending tasks will not fire after this object is 280 // This is used to ensure pending tasks will not fire after this object is
281 // destroyed. 281 // destroyed.
282 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; 282 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
283 283
284 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); 284 DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
285 }; 285 };
286 286
287 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 287 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/guest_view/guest_view_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698