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

Side by Side Diff: chrome/browser/tab_render_watcher.cc

Issue 9600036: Move Render(View|Widget)Host and associated classes to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_render_watcher.h ('k') | chrome/browser/tab_render_watcher_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 #include "chrome/browser/tab_render_watcher.h" 5 #include "chrome/browser/tab_render_watcher.h"
6 6
7 #include "content/public/browser/notification_details.h" 7 #include "content/public/browser/notification_details.h"
8 #include "content/public/browser/notification_source.h" 8 #include "content/public/browser/notification_source.h"
9 #include "content/public/browser/notification_types.h" 9 #include "content/public/browser/notification_types.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 12
13 using content::RenderWidgetHost;
13 using content::WebContents; 14 using content::WebContents;
14 15
15 TabRenderWatcher::TabRenderWatcher(WebContents* tab, Delegate* delegate) 16 TabRenderWatcher::TabRenderWatcher(WebContents* tab, Delegate* delegate)
16 : loaded_(false), 17 : loaded_(false),
17 web_contents_(tab), 18 web_contents_(tab),
18 delegate_(delegate) { 19 delegate_(delegate) {
19 registrar_.Add(this, 20 registrar_.Add(this,
20 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, 21 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
21 content::Source<WebContents>(web_contents_)); 22 content::Source<WebContents>(web_contents_));
22 registrar_.Add(this, 23 registrar_.Add(this,
23 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 24 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
24 content::Source<WebContents>(web_contents_)); 25 content::Source<WebContents>(web_contents_));
25 } 26 }
26 27
27 void TabRenderWatcher::Observe(int type, 28 void TabRenderWatcher::Observe(int type,
28 const content::NotificationSource& source, 29 const content::NotificationSource& source,
29 const content::NotificationDetails& details) { 30 const content::NotificationDetails& details) {
30 switch (type) { 31 switch (type) {
31 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { 32 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: {
32 RenderWidgetHost* rwh = content::Details<RenderWidgetHost>(details).ptr(); 33 RenderWidgetHost* rwh = content::Details<RenderWidgetHost>(details).ptr();
33 registrar_.Add(this, 34 registrar_.Add(this,
34 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, 35 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT,
35 content::Source<RenderWidgetHost>(rwh)); 36 content::Source<RenderWidgetHost>(rwh));
36 delegate_->OnRenderHostCreated( 37 delegate_->OnRenderHostCreated(
37 content::Details<RenderViewHost>(details).ptr()); 38 content::Details<content::RenderViewHost>(details).ptr());
38 break; 39 break;
39 } 40 }
40 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: 41 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME:
41 if (!loaded_) { 42 if (!loaded_) {
42 loaded_ = true; 43 loaded_ = true;
43 delegate_->OnTabMainFrameLoaded(); 44 delegate_->OnTabMainFrameLoaded();
44 } 45 }
45 break; 46 break;
46 case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: 47 case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT:
47 if (loaded_) 48 if (loaded_)
48 delegate_->OnTabMainFrameRender(); 49 delegate_->OnTabMainFrameRender();
49 break; 50 break;
50 default: 51 default:
51 NOTREACHED() << "Unknown notification " << type; 52 NOTREACHED() << "Unknown notification " << type;
52 } 53 }
53 } 54 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_render_watcher.h ('k') | chrome/browser/tab_render_watcher_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698