Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
| 18 #include "base/property_bag.h" | 18 #include "base/property_bag.h" |
| 19 #include "base/string16.h" | 19 #include "base/string16.h" |
| 20 #include "base/timer.h" | 20 #include "base/timer.h" |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "content/public/browser/render_widget_host.h" | 22 #include "content/public/browser/render_widget_host.h" |
| 23 #include "content/public/common/page_zoom.h" | 23 #include "content/public/common/page_zoom.h" |
| 24 #include "ui/base/ime/text_input_type.h" | 24 #include "ui/base/ime/text_input_type.h" |
| 25 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
| 26 | 26 |
| 27 class BackingStore; | 27 class BackingStore; |
| 28 class MockRenderWidgetHost; | |
| 29 class WebCursor; | |
| 28 struct EditCommand; | 30 struct EditCommand; |
| 29 struct ViewHostMsg_UpdateRect_Params; | 31 struct ViewHostMsg_UpdateRect_Params; |
| 30 class WebCursor; | |
| 31 | 32 |
| 32 namespace base { | 33 namespace base { |
| 33 class TimeTicks; | 34 class TimeTicks; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace content { | |
| 37 class RenderWidgetHostViewPort; | |
| 38 } | |
| 39 | |
| 40 namespace ui { | 37 namespace ui { |
| 41 class Range; | 38 class Range; |
| 42 } | 39 } |
| 43 | 40 |
| 44 namespace WebKit { | 41 namespace WebKit { |
| 45 class WebInputEvent; | 42 class WebInputEvent; |
| 46 class WebMouseEvent; | 43 class WebMouseEvent; |
| 47 struct WebCompositionUnderline; | 44 struct WebCompositionUnderline; |
| 48 struct WebScreenInfo; | 45 struct WebScreenInfo; |
| 49 } | 46 } |
| 50 | 47 |
| 48 namespace content { | |
| 49 | |
| 50 class RenderWidgetHostViewPort; | |
| 51 | |
| 51 // This implements the RenderWidgetHost interface that is exposed to | 52 // This implements the RenderWidgetHost interface that is exposed to |
| 52 // embedders of content, and adds things only visible to content. | 53 // embedders of content, and adds things only visible to content. |
| 53 // | |
| 54 // TODO(joi): Move to content namespace. | |
| 55 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, | 54 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, |
| 56 public IPC::Channel::Listener { | 55 public IPC::Channel::Listener { |
| 57 public: | 56 public: |
| 58 // routing_id can be MSG_ROUTING_NONE, in which case the next available | 57 // routing_id can be MSG_ROUTING_NONE, in which case the next available |
| 59 // routing id is taken from the RenderProcessHost. | 58 // routing id is taken from the RenderProcessHost. |
| 60 RenderWidgetHostImpl(content::RenderProcessHost* process, int routing_id); | 59 RenderWidgetHostImpl(content::RenderProcessHost* process, int routing_id); |
|
jam
2012/03/05 23:59:28
ditto
Jói
2012/03/06 16:38:55
Done.
| |
| 61 virtual ~RenderWidgetHostImpl(); | 60 virtual ~RenderWidgetHostImpl(); |
| 62 | 61 |
| 63 // Use RenderWidgetHostImpl::From(rwh) to downcast a | 62 // Use RenderWidgetHostImpl::From(rwh) to downcast a |
| 64 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this | 63 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this |
| 65 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). | 64 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). |
| 66 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); | 65 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); |
| 67 | 66 |
| 68 // RenderWidgetHost implementation. | 67 // RenderWidgetHost implementation. |
| 69 virtual void Undo() OVERRIDE; | 68 virtual void Undo() OVERRIDE; |
| 70 virtual void Redo() OVERRIDE; | 69 virtual void Redo() OVERRIDE; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 | 409 |
| 411 // true if a renderer has once been valid. We use this flag to display a sad | 410 // true if a renderer has once been valid. We use this flag to display a sad |
| 412 // tab only when we lose our renderer and not if a paint occurs during | 411 // tab only when we lose our renderer and not if a paint occurs during |
| 413 // initialization. | 412 // initialization. |
| 414 bool renderer_initialized_; | 413 bool renderer_initialized_; |
| 415 | 414 |
| 416 // This value indicates how long to wait before we consider a renderer hung. | 415 // This value indicates how long to wait before we consider a renderer hung. |
| 417 int hung_renderer_delay_ms_; | 416 int hung_renderer_delay_ms_; |
| 418 | 417 |
| 419 private: | 418 private: |
| 420 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, Resize); | 419 friend class ::MockRenderWidgetHost; |
| 421 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, ResizeThenCrash); | |
| 422 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, HiddenPaint); | |
| 423 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, PaintAtSize); | |
| 424 | 420 |
| 425 // Tell this object to destroy itself. | 421 // Tell this object to destroy itself. |
| 426 void Destroy(); | 422 void Destroy(); |
| 427 | 423 |
| 428 // Checks whether the renderer is hung and calls NotifyRendererUnresponsive | 424 // Checks whether the renderer is hung and calls NotifyRendererUnresponsive |
| 429 // if it is. | 425 // if it is. |
| 430 void CheckRendererIsUnresponsive(); | 426 void CheckRendererIsUnresponsive(); |
| 431 | 427 |
| 432 // Called if we know the renderer is responsive. When we currently think the | 428 // Called if we know the renderer is responsive. When we currently think the |
| 433 // renderer is unresponsive, this will clear that state and call | 429 // renderer is unresponsive, this will clear that state and call |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 // Keeps track of whether the webpage has any touch event handler. If it does, | 668 // Keeps track of whether the webpage has any touch event handler. If it does, |
| 673 // then touch events are sent to the renderer. Otherwise, the touch events are | 669 // then touch events are sent to the renderer. Otherwise, the touch events are |
| 674 // not sent to the renderer. | 670 // not sent to the renderer. |
| 675 bool has_touch_handler_; | 671 bool has_touch_handler_; |
| 676 | 672 |
| 677 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 673 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
| 678 | 674 |
| 679 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 675 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
| 680 }; | 676 }; |
| 681 | 677 |
| 678 } // namespace content | |
| 679 | |
| 682 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 680 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| OLD | NEW |