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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.h

Issue 1711103002: Implement lifetime observer on RenderWidgetHostViewBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to r378132. Created 4 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
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_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/observer_list.h"
17 #include "base/process/kill.h" 18 #include "base/process/kill.h"
18 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "cc/output/compositor_frame.h" 21 #include "cc/output/compositor_frame.h"
21 #include "cc/surfaces/surface_id.h" 22 #include "cc/surfaces/surface_id.h"
22 #include "content/browser/renderer_host/event_with_latency_info.h" 23 #include "content/browser/renderer_host/event_with_latency_info.h"
23 #include "content/common/content_export.h" 24 #include "content/common/content_export.h"
24 #include "content/common/input/input_event_ack_state.h" 25 #include "content/common/input/input_event_ack_state.h"
25 #include "content/public/browser/readback_types.h" 26 #include "content/public/browser/readback_types.h"
26 #include "content/public/browser/render_widget_host_view.h" 27 #include "content/public/browser/render_widget_host_view.h"
(...skipping 29 matching lines...) Expand all
56 class SurfaceHittestDelegate; 57 class SurfaceHittestDelegate;
57 } 58 }
58 59
59 namespace ui { 60 namespace ui {
60 class LatencyInfo; 61 class LatencyInfo;
61 } 62 }
62 63
63 namespace content { 64 namespace content {
64 class BrowserAccessibilityDelegate; 65 class BrowserAccessibilityDelegate;
65 class BrowserAccessibilityManager; 66 class BrowserAccessibilityManager;
67 class RenderWidgetHostViewBaseObserver;
66 class SyntheticGesture; 68 class SyntheticGesture;
67 class SyntheticGestureTarget; 69 class SyntheticGestureTarget;
68 class WebCursor; 70 class WebCursor;
69 struct DidOverscrollParams; 71 struct DidOverscrollParams;
70 struct NativeWebKeyboardEvent; 72 struct NativeWebKeyboardEvent;
71 struct WebPluginGeometry; 73 struct WebPluginGeometry;
72 74
73 // Basic implementation shared by concrete RenderWidgetHostView subclasses. 75 // Basic implementation shared by concrete RenderWidgetHostView subclasses.
74 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, 76 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
75 public IPC::Listener { 77 public IPC::Listener {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 384
383 // Returns an HWND that's given as the parent window for windowless Flash to 385 // Returns an HWND that's given as the parent window for windowless Flash to
384 // workaround crbug.com/301548. 386 // workaround crbug.com/301548.
385 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const = 0; 387 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const = 0;
386 388
387 // The callback that DetachPluginsHelper calls for each child window. Call 389 // The callback that DetachPluginsHelper calls for each child window. Call
388 // this directly if you want to do custom filtering on plugin windows first. 390 // this directly if you want to do custom filtering on plugin windows first.
389 static void DetachPluginWindowsCallback(HWND window); 391 static void DetachPluginWindowsCallback(HWND window);
390 #endif 392 #endif
391 393
394 // Add and remove observers for lifetime event notifications. The order in
395 // which notifications are sent to observers is undefined. Clients must be
396 // sure to remove the observer before they go away.
397 void AddObserver(RenderWidgetHostViewBaseObserver* observer);
398 void RemoveObserver(RenderWidgetHostViewBaseObserver* observer);
399
392 // Exposed for testing. 400 // Exposed for testing.
393 virtual cc::SurfaceId SurfaceIdForTesting() const; 401 virtual cc::SurfaceId SurfaceIdForTesting() const;
394 402
395 protected: 403 protected:
396 // Interface class only, do not construct. 404 // Interface class only, do not construct.
397 RenderWidgetHostViewBase(); 405 RenderWidgetHostViewBase();
398 406
407 void NotifyObserversAboutShutdown();
408
399 #if defined(OS_WIN) 409 #if defined(OS_WIN)
400 // Shared implementation of MovePluginWindows for use by win and aura/wina. 410 // Shared implementation of MovePluginWindows for use by win and aura/wina.
401 static void MovePluginWindowsHelper( 411 static void MovePluginWindowsHelper(
402 HWND parent, 412 HWND parent,
403 const std::vector<WebPluginGeometry>& moves); 413 const std::vector<WebPluginGeometry>& moves);
404 414
405 static void PaintPluginWindowsHelper( 415 static void PaintPluginWindowsHelper(
406 HWND parent, 416 HWND parent,
407 const gfx::Rect& damaged_screen_rect); 417 const gfx::Rect& damaged_screen_rect);
408 418
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 461
452 private: 462 private:
453 void FlushInput(); 463 void FlushInput();
454 464
455 gfx::Rect current_display_area_; 465 gfx::Rect current_display_area_;
456 466
457 uint32_t renderer_frame_number_; 467 uint32_t renderer_frame_number_;
458 468
459 base::OneShotTimer flush_input_timer_; 469 base::OneShotTimer flush_input_timer_;
460 470
471 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_;
472
461 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; 473 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
462 474
463 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); 475 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
464 }; 476 };
465 477
466 } // namespace content 478 } // namespace content
467 479
468 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 480 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698