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

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 2752283004: Add the ability to override WebContentsBindingSet binders for testing (Closed)
Patch Set: . Created 3 years, 9 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 | content/browser/web_contents_binding_set_browsertest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <functional> 10 #include <functional>
(...skipping 19 matching lines...) Expand all
30 #include "content/browser/media/audio_stream_monitor.h" 30 #include "content/browser/media/audio_stream_monitor.h"
31 #include "content/browser/renderer_host/render_view_host_delegate.h" 31 #include "content/browser/renderer_host/render_view_host_delegate.h"
32 #include "content/browser/renderer_host/render_view_host_impl.h" 32 #include "content/browser/renderer_host/render_view_host_impl.h"
33 #include "content/browser/renderer_host/render_widget_host_delegate.h" 33 #include "content/browser/renderer_host/render_widget_host_delegate.h"
34 #include "content/common/accessibility_mode.h" 34 #include "content/common/accessibility_mode.h"
35 #include "content/common/content_export.h" 35 #include "content/common/content_export.h"
36 #include "content/public/browser/color_chooser.h" 36 #include "content/public/browser/color_chooser.h"
37 #include "content/public/browser/notification_observer.h" 37 #include "content/public/browser/notification_observer.h"
38 #include "content/public/browser/notification_registrar.h" 38 #include "content/public/browser/notification_registrar.h"
39 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
40 #include "content/public/browser/web_contents_binding_set.h"
40 #include "content/public/browser/web_contents_observer.h" 41 #include "content/public/browser/web_contents_observer.h"
41 #include "content/public/common/page_importance_signals.h" 42 #include "content/public/common/page_importance_signals.h"
42 #include "content/public/common/renderer_preferences.h" 43 #include "content/public/common/renderer_preferences.h"
43 #include "content/public/common/resource_type.h" 44 #include "content/public/common/resource_type.h"
44 #include "content/public/common/three_d_api_types.h" 45 #include "content/public/common/three_d_api_types.h"
45 #include "net/base/load_states.h" 46 #include "net/base/load_states.h"
46 #include "net/http/http_response_headers.h" 47 #include "net/http/http_response_headers.h"
47 #include "ppapi/features/features.h" 48 #include "ppapi/features/features.h"
48 #include "third_party/WebKit/public/platform/WebDragOperation.h" 49 #include "third_party/WebKit/public/platform/WebDragOperation.h"
49 #include "ui/base/page_transition_types.h" 50 #include "ui/base/page_transition_types.h"
(...skipping 22 matching lines...) Expand all
72 class RenderViewHostDelegateView; 73 class RenderViewHostDelegateView;
73 class RenderWidgetHostImpl; 74 class RenderWidgetHostImpl;
74 class RenderWidgetHostInputEventRouter; 75 class RenderWidgetHostInputEventRouter;
75 class SavePackage; 76 class SavePackage;
76 class ScreenOrientationProvider; 77 class ScreenOrientationProvider;
77 class SiteInstance; 78 class SiteInstance;
78 class TestWebContents; 79 class TestWebContents;
79 class TextInputManager; 80 class TextInputManager;
80 class WakeLockServiceContext; 81 class WakeLockServiceContext;
81 class WebContentsAudioMuter; 82 class WebContentsAudioMuter;
82 class WebContentsBindingSet;
83 class WebContentsDelegate; 83 class WebContentsDelegate;
84 class WebContentsImpl; 84 class WebContentsImpl;
85 class WebContentsView; 85 class WebContentsView;
86 class WebContentsViewDelegate; 86 class WebContentsViewDelegate;
87 struct AXEventNotificationDetails; 87 struct AXEventNotificationDetails;
88 struct ColorSuggestion; 88 struct ColorSuggestion;
89 struct FaviconURL; 89 struct FaviconURL;
90 struct LoadNotificationDetails; 90 struct LoadNotificationDetails;
91 struct MHTMLGenerationParams; 91 struct MHTMLGenerationParams;
92 struct ResourceRedirectDetails; 92 struct ResourceRedirectDetails;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 // Adds a new binding set to the WebContents. Returns a closure which may be 256 // Adds a new binding set to the WebContents. Returns a closure which may be
257 // used to remove the binding set at any time. The closure is safe to call 257 // used to remove the binding set at any time. The closure is safe to call
258 // even after WebContents destruction. 258 // even after WebContents destruction.
259 // 259 //
260 // |binding_set| is not owned and must either outlive this WebContents or be 260 // |binding_set| is not owned and must either outlive this WebContents or be
261 // explicitly removed before being destroyed. 261 // explicitly removed before being destroyed.
262 base::Closure AddBindingSet(const std::string& interface_name, 262 base::Closure AddBindingSet(const std::string& interface_name,
263 WebContentsBindingSet* binding_set); 263 WebContentsBindingSet* binding_set);
264 264
265 // Overrides the incoming Channel-associated interface request handler for
266 // interfaces registered with this WebContents via a WebContentsBindingSet.
267 // |binder| will live until either the binder is overridden again or the
268 // WebContents is destroyed.
269 template <typename Interface>
270 void OverrideBinderForTesting(
271 std::unique_ptr<WebContentsBindingSet::Binder> binder) {
272 auto it = binding_sets_.find(Interface::Name_);
273 DCHECK(it != binding_sets_.end());
274 it->second->SetBinderForTesting(std::move(binder));
275 }
276
265 // WebContents ------------------------------------------------------ 277 // WebContents ------------------------------------------------------
266 WebContentsDelegate* GetDelegate() override; 278 WebContentsDelegate* GetDelegate() override;
267 void SetDelegate(WebContentsDelegate* delegate) override; 279 void SetDelegate(WebContentsDelegate* delegate) override;
268 NavigationControllerImpl& GetController() override; 280 NavigationControllerImpl& GetController() override;
269 const NavigationControllerImpl& GetController() const override; 281 const NavigationControllerImpl& GetController() const override;
270 BrowserContext* GetBrowserContext() const override; 282 BrowserContext* GetBrowserContext() const override;
271 const GURL& GetURL() const override; 283 const GURL& GetURL() const override;
272 const GURL& GetVisibleURL() const override; 284 const GURL& GetVisibleURL() const override;
273 const GURL& GetLastCommittedURL() const override; 285 const GURL& GetLastCommittedURL() const override;
274 RenderProcessHost* GetRenderProcessHost() const override; 286 RenderProcessHost* GetRenderProcessHost() const override;
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 // Adds/removes a callback called on creation of each new WebContents. 1561 // Adds/removes a callback called on creation of each new WebContents.
1550 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); 1562 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1551 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); 1563 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1552 1564
1553 DISALLOW_COPY_AND_ASSIGN(FriendZone); 1565 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1554 }; 1566 };
1555 1567
1556 } // namespace content 1568 } // namespace content
1557 1569
1558 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1570 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents_binding_set_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698