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

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: Restructure, and make RWHVB derived classes responsible for early notification. Created 4 years, 10 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 "content/browser/renderer_host/event_with_latency_info.h" 22 #include "content/browser/renderer_host/event_with_latency_info.h"
22 #include "content/common/content_export.h" 23 #include "content/common/content_export.h"
23 #include "content/common/input/input_event_ack_state.h" 24 #include "content/common/input/input_event_ack_state.h"
24 #include "content/public/browser/readback_types.h" 25 #include "content/public/browser/readback_types.h"
25 #include "content/public/browser/render_widget_host_view.h" 26 #include "content/public/browser/render_widget_host_view.h"
26 #include "ipc/ipc_listener.h" 27 #include "ipc/ipc_listener.h"
(...skipping 28 matching lines...) Expand all
55 class SurfaceHittestDelegate; 56 class SurfaceHittestDelegate;
56 } 57 }
57 58
58 namespace ui { 59 namespace ui {
59 class LatencyInfo; 60 class LatencyInfo;
60 } 61 }
61 62
62 namespace content { 63 namespace content {
63 class BrowserAccessibilityDelegate; 64 class BrowserAccessibilityDelegate;
64 class BrowserAccessibilityManager; 65 class BrowserAccessibilityManager;
66 class RenderWidgetHostViewBaseObserver;
65 class SyntheticGesture; 67 class SyntheticGesture;
66 class SyntheticGestureTarget; 68 class SyntheticGestureTarget;
67 class WebCursor; 69 class WebCursor;
68 struct DidOverscrollParams; 70 struct DidOverscrollParams;
69 struct NativeWebKeyboardEvent; 71 struct NativeWebKeyboardEvent;
70 struct WebPluginGeometry; 72 struct WebPluginGeometry;
71 73
72 // Basic implementation shared by concrete RenderWidgetHostView subclasses. 74 // Basic implementation shared by concrete RenderWidgetHostView subclasses.
73 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, 75 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
74 public IPC::Listener { 76 public IPC::Listener {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 383
382 // Returns an HWND that's given as the parent window for windowless Flash to 384 // Returns an HWND that's given as the parent window for windowless Flash to
383 // workaround crbug.com/301548. 385 // workaround crbug.com/301548.
384 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const = 0; 386 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const = 0;
385 387
386 // The callback that DetachPluginsHelper calls for each child window. Call 388 // The callback that DetachPluginsHelper calls for each child window. Call
387 // this directly if you want to do custom filtering on plugin windows first. 389 // this directly if you want to do custom filtering on plugin windows first.
388 static void DetachPluginWindowsCallback(HWND window); 390 static void DetachPluginWindowsCallback(HWND window);
389 #endif 391 #endif
390 392
393 // Add and remove observers for lifetime event notifications. The order in
394 // which notifications are sent to observers is undefined. Clients must be
395 // sure to remove the observer before they go away.
396 void AddObserver(RenderWidgetHostViewBaseObserver* observer);
397 void RemoveObserver(RenderWidgetHostViewBaseObserver* observer);
398
391 protected: 399 protected:
392 // Interface class only, do not construct. 400 // Interface class only, do not construct.
393 RenderWidgetHostViewBase(); 401 RenderWidgetHostViewBase();
394 402
403 void NotifyObserversAboutShutdown();
404
395 #if defined(OS_WIN) 405 #if defined(OS_WIN)
396 // Shared implementation of MovePluginWindows for use by win and aura/wina. 406 // Shared implementation of MovePluginWindows for use by win and aura/wina.
397 static void MovePluginWindowsHelper( 407 static void MovePluginWindowsHelper(
398 HWND parent, 408 HWND parent,
399 const std::vector<WebPluginGeometry>& moves); 409 const std::vector<WebPluginGeometry>& moves);
400 410
401 static void PaintPluginWindowsHelper( 411 static void PaintPluginWindowsHelper(
402 HWND parent, 412 HWND parent,
403 const gfx::Rect& damaged_screen_rect); 413 const gfx::Rect& damaged_screen_rect);
404 414
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 457
448 private: 458 private:
449 void FlushInput(); 459 void FlushInput();
450 460
451 gfx::Rect current_display_area_; 461 gfx::Rect current_display_area_;
452 462
453 uint32_t renderer_frame_number_; 463 uint32_t renderer_frame_number_;
454 464
455 base::OneShotTimer flush_input_timer_; 465 base::OneShotTimer flush_input_timer_;
456 466
467 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_;
468
457 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; 469 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
458 470
459 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); 471 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
460 }; 472 };
461 473
462 } // namespace content 474 } // namespace content
463 475
464 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 476 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698