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

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

Issue 9150016: Move creation and ownership of ResourceDispatcherHost and PluginService to content. This gives a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix chromeos ui_tests Created 8 years, 11 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/browser/renderer_host/resource_dispatcher_host.h"
17 #include "content/shell/shell.h" 16 #include "content/shell/shell.h"
18 #include "content/shell/shell_browser_context.h" 17 #include "content/shell/shell_browser_context.h"
19 #include "content/shell/shell_content_browser_client.h" 18 #include "content/shell/shell_content_browser_client.h"
20 #include "net/base/net_module.h" 19 #include "net/base/net_module.h"
21 #include "ui/base/clipboard/clipboard.h" 20 #include "ui/base/clipboard/clipboard.h"
22 21
23 namespace content { 22 namespace content {
24 23
25 static GURL GetStartupURL() { 24 static GURL GetStartupURL() {
26 const CommandLine::StringVector& args = 25 const CommandLine::StringVector& args =
(...skipping 14 matching lines...) Expand all
41 } 40 }
42 41
43 ShellBrowserMainParts::~ShellBrowserMainParts() { 42 ShellBrowserMainParts::~ShellBrowserMainParts() {
44 } 43 }
45 44
46 void ShellBrowserMainParts::PreMainMessageLoopRun() { 45 void ShellBrowserMainParts::PreMainMessageLoopRun() {
47 browser_context_.reset(new ShellBrowserContext(this)); 46 browser_context_.reset(new ShellBrowserContext(this));
48 47
49 Shell::PlatformInitialize(); 48 Shell::PlatformInitialize();
50 net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider); 49 net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider);
51 PluginService::GetInstance()->Init();
52 50
53 Shell::CreateNewWindow(browser_context_.get(), 51 Shell::CreateNewWindow(browser_context_.get(),
54 GetStartupURL(), 52 GetStartupURL(),
55 NULL, 53 NULL,
56 MSG_ROUTING_NONE, 54 MSG_ROUTING_NONE,
57 NULL); 55 NULL);
58 } 56 }
59 57
60 void ShellBrowserMainParts::PostMainMessageLoopRun() { 58 void ShellBrowserMainParts::PostMainMessageLoopRun() {
61 browser_context_.reset(); 59 browser_context_.reset();
62
63 resource_dispatcher_host_->download_file_manager()->Shutdown();
64 resource_dispatcher_host_->save_file_manager()->Shutdown();
65 resource_dispatcher_host_->Shutdown();
66 }
67
68 void ShellBrowserMainParts::PreStopThread(BrowserThread::ID id) {
69 if (id == BrowserThread::WEBKIT_DEPRECATED) {
70 resource_dispatcher_host_.reset();
71 }
72 } 60 }
73 61
74 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { 62 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
75 return false; 63 return false;
76 } 64 }
77 65
78 ResourceDispatcherHost* ShellBrowserMainParts::GetResourceDispatcherHost() {
79 if (!resource_dispatcher_host_.get()) {
80 ResourceQueue::DelegateSet resource_queue_delegates;
81 resource_dispatcher_host_.reset(
82 new ResourceDispatcherHost(resource_queue_delegates));
83 resource_dispatcher_host_->Initialize();
84 }
85 return resource_dispatcher_host_.get();
86 }
87
88 ui::Clipboard* ShellBrowserMainParts::GetClipboard() { 66 ui::Clipboard* ShellBrowserMainParts::GetClipboard() {
89 if (!clipboard_.get()) 67 if (!clipboard_.get())
90 clipboard_.reset(new ui::Clipboard()); 68 clipboard_.reset(new ui::Clipboard());
91 return clipboard_.get(); 69 return clipboard_.get();
92 } 70 }
93 71
94 } // namespace 72 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698