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

Side by Side Diff: content/shell/shell_browser_main.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_browser_main.h" 5 #include "content/shell/shell_browser_main.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "base/threading/thread_restrictions.h" 11 #include "base/threading/thread_restrictions.h"
12 #include "content/browser/browser_process_sub_thread.h" 12 #include "content/browser/browser_process_sub_thread.h"
13 #include "content/browser/download/download_file_manager.h" 13 #include "content/browser/download/download_file_manager.h"
14 #include "content/browser/download/save_file_manager.h" 14 #include "content/browser/download/save_file_manager.h"
15 #include "content/browser/plugin_service_impl.h" 15 #include "content/browser/plugin_service_impl.h"
16 #include "content/public/common/main_function_params.h"
16 #include "content/shell/shell.h" 17 #include "content/shell/shell.h"
17 #include "content/shell/shell_browser_context.h" 18 #include "content/shell/shell_browser_context.h"
18 #include "content/shell/shell_content_browser_client.h" 19 #include "content/shell/shell_content_browser_client.h"
20 #include "content/shell/shell_switches.h"
19 #include "net/base/net_module.h" 21 #include "net/base/net_module.h"
20 #include "ui/base/clipboard/clipboard.h" 22 #include "ui/base/clipboard/clipboard.h"
21 23
22 namespace content { 24 namespace content {
23 25
24 static GURL GetStartupURL() { 26 static GURL GetStartupURL() {
25 const CommandLine::StringVector& args = 27 const CommandLine::StringVector& args =
26 CommandLine::ForCurrentProcess()->GetArgs(); 28 CommandLine::ForCurrentProcess()->GetArgs();
27 if (args.empty()) 29 if (args.empty())
28 return GURL("http://www.google.com/"); 30 return GURL("http://www.google.com/");
29 31
30 return GURL(args[0]); 32 return GURL(args[0]);
31 } 33 }
32 34
33 ShellBrowserMainParts::ShellBrowserMainParts( 35 ShellBrowserMainParts::ShellBrowserMainParts(
34 const content::MainFunctionParams& parameters) 36 const content::MainFunctionParams& parameters)
35 : BrowserMainParts() { 37 : BrowserMainParts(),
38 dump_as_text_(parameters.command_line.HasSwitch(switches::kTree)) {
36 ShellContentBrowserClient* shell_browser_client = 39 ShellContentBrowserClient* shell_browser_client =
37 static_cast<ShellContentBrowserClient*>( 40 static_cast<ShellContentBrowserClient*>(
38 content::GetContentClient()->browser()); 41 content::GetContentClient()->browser());
39 shell_browser_client->set_shell_browser_main_parts(this); 42 shell_browser_client->set_shell_browser_main_parts(this);
40 } 43 }
41 44
42 ShellBrowserMainParts::~ShellBrowserMainParts() { 45 ShellBrowserMainParts::~ShellBrowserMainParts() {
43 } 46 }
44 47
45 void ShellBrowserMainParts::PreMainMessageLoopRun() { 48 void ShellBrowserMainParts::PreMainMessageLoopRun() {
46 browser_context_.reset(new ShellBrowserContext(this)); 49 browser_context_.reset(new ShellBrowserContext(this));
47 50
48 Shell::PlatformInitialize(); 51 Shell::PlatformInitialize();
49 net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider); 52 net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider);
50 53
51 Shell::CreateNewWindow(browser_context_.get(), 54 Shell* shell = Shell::CreateNewWindow(browser_context_.get(),
52 GetStartupURL(), 55 GetStartupURL(),
53 NULL, 56 NULL,
54 MSG_ROUTING_NONE, 57 MSG_ROUTING_NONE,
55 NULL); 58 NULL);
59 shell->SetDumpAsText(dump_as_text_);
56 } 60 }
57 61
58 void ShellBrowserMainParts::PostMainMessageLoopRun() { 62 void ShellBrowserMainParts::PostMainMessageLoopRun() {
59 browser_context_.reset(); 63 browser_context_.reset();
60 } 64 }
61 65
62 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { 66 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
63 return false; 67 return false;
64 } 68 }
65 69
66 ui::Clipboard* ShellBrowserMainParts::GetClipboard() { 70 ui::Clipboard* ShellBrowserMainParts::GetClipboard() {
67 if (!clipboard_.get()) 71 if (!clipboard_.get())
68 clipboard_.reset(new ui::Clipboard()); 72 clipboard_.reset(new ui::Clipboard());
69 return clipboard_.get(); 73 return clipboard_.get();
70 } 74 }
71 75
72 } // namespace 76 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698