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

Side by Side Diff: content/shell/shell.cc

Issue 9289045: Add option --dump-render-tree to content_shell to dump the render tree as text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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 "content/shell/shell.h" 5 #include "content/shell/shell.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "content/browser/renderer_host/render_view_host.h"
10 #include "content/browser/tab_contents/navigation_controller_impl.h" 11 #include "content/browser/tab_contents/navigation_controller_impl.h"
11 #include "content/browser/tab_contents/tab_contents.h" 12 #include "content/browser/tab_contents/tab_contents.h"
13 #include "content/shell/shell_messages.h"
12 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
13 15
14 // Content area size for newly created windows. 16 // Content area size for newly created windows.
15 static const int kTestWindowWidth = 800; 17 static const int kTestWindowWidth = 800;
16 static const int kTestWindowHeight = 600; 18 static const int kTestWindowHeight = 600;
17 19
18 namespace content { 20 namespace content {
19 21
20 std::vector<Shell*> Shell::windows_; 22 std::vector<Shell*> Shell::windows_;
21 23
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 98
97 void Shell::UpdateNavigationControls() { 99 void Shell::UpdateNavigationControls() {
98 int current_index = tab_contents_->GetController().GetCurrentEntryIndex(); 100 int current_index = tab_contents_->GetController().GetCurrentEntryIndex();
99 int max_index = tab_contents_->GetController().GetEntryCount() - 1; 101 int max_index = tab_contents_->GetController().GetEntryCount() - 1;
100 102
101 PlatformEnableUIControl(BACK_BUTTON, current_index > 0); 103 PlatformEnableUIControl(BACK_BUTTON, current_index > 0);
102 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); 104 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index);
103 PlatformEnableUIControl(STOP_BUTTON, tab_contents_->IsLoading()); 105 PlatformEnableUIControl(STOP_BUTTON, tab_contents_->IsLoading());
104 } 106 }
105 107
108 void Shell::SetDumpAsText(bool dump_as_text) {
109 dump_as_text_ = dump_as_text;
110 }
111
106 gfx::NativeView Shell::GetContentView() { 112 gfx::NativeView Shell::GetContentView() {
107 if (!tab_contents_.get()) 113 if (!tab_contents_.get())
108 return NULL; 114 return NULL;
109 return tab_contents_->GetNativeView(); 115 return tab_contents_->GetNativeView();
110 } 116 }
111 117
112 void Shell::LoadingStateChanged(WebContents* source) { 118 void Shell::LoadingStateChanged(WebContents* source) {
113 UpdateNavigationControls(); 119 UpdateNavigationControls();
114 PlatformSetIsLoading(source->IsLoading()); 120 PlatformSetIsLoading(source->IsLoading());
115 } 121 }
116 122
123 void Shell::DidFinishLoad(WebContents* source) {
124 if (!dump_as_text_)
125 return;
126 RenderViewHost* render_view_host = source->GetRenderViewHost();
127 render_view_host->Send(
128 new ShellViewMsg_CaptureTextDump(render_view_host->routing_id(), false));
129 }
130
117 void Shell::WebContentsCreated(WebContents* source_contents, 131 void Shell::WebContentsCreated(WebContents* source_contents,
118 int64 source_frame_id, 132 int64 source_frame_id,
119 const GURL& target_url, 133 const GURL& target_url,
120 WebContents* new_contents) { 134 WebContents* new_contents) {
121 CreateShell(static_cast<TabContents*>(new_contents)); 135 CreateShell(static_cast<TabContents*>(new_contents));
122 } 136 }
123 137
124 void Shell::DidNavigateMainFramePostCommit(WebContents* tab) { 138 void Shell::DidNavigateMainFramePostCommit(WebContents* tab) {
125 PlatformSetAddressBarURL(tab->GetURL()); 139 PlatformSetAddressBarURL(tab->GetURL());
126 } 140 }
127 141
128 void Shell::UpdatePreferredSize(WebContents* source, 142 void Shell::UpdatePreferredSize(WebContents* source,
129 const gfx::Size& pref_size) { 143 const gfx::Size& pref_size) {
130 PlatformSizeTo(pref_size.width(), pref_size.height()); 144 PlatformSizeTo(pref_size.width(), pref_size.height());
131 } 145 }
132 146
133 } // namespace content 147 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698