| OLD | NEW |
| 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/message_loop.h" | 8 #include "base/message_loop.h" |
| 8 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 9 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| 10 #include "content/browser/browser_process_sub_thread.h" | 11 #include "content/browser/browser_process_sub_thread.h" |
| 11 #include "content/browser/download/download_file_manager.h" | 12 #include "content/browser/download/download_file_manager.h" |
| 12 #include "content/browser/download/save_file_manager.h" | 13 #include "content/browser/download/save_file_manager.h" |
| 13 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 14 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 14 #include "content/shell/shell.h" | 15 #include "content/shell/shell.h" |
| 15 #include "content/shell/shell_browser_context.h" | 16 #include "content/shell/shell_browser_context.h" |
| 16 #include "content/shell/shell_content_browser_client.h" | 17 #include "content/shell/shell_content_browser_client.h" |
| 17 #include "net/base/net_module.h" | 18 #include "net/base/net_module.h" |
| 18 #include "ui/base/clipboard/clipboard.h" | 19 #include "ui/base/clipboard/clipboard.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 22 ShellBrowserMainParts::ShellBrowserMainParts( | 23 ShellBrowserMainParts::ShellBrowserMainParts( |
| 23 const content::MainFunctionParams& parameters) | 24 const content::MainFunctionParams& parameters) |
| 24 : BrowserMainParts() { | 25 : BrowserMainParts() { |
| 25 ShellContentBrowserClient* shell_browser_client = | 26 ShellContentBrowserClient* shell_browser_client = |
| 26 static_cast<ShellContentBrowserClient*>( | 27 static_cast<ShellContentBrowserClient*>( |
| 27 content::GetContentClient()->browser()); | 28 content::GetContentClient()->browser()); |
| 28 shell_browser_client->set_shell_browser_main_parts(this); | 29 shell_browser_client->set_shell_browser_main_parts(this); |
| 29 } | 30 } |
| 30 | 31 |
| 31 ShellBrowserMainParts::~ShellBrowserMainParts() { | 32 ShellBrowserMainParts::~ShellBrowserMainParts() { |
| 32 base::ThreadRestrictions::SetIOAllowed(true); | 33 base::ThreadRestrictions::SetIOAllowed(true); |
| 33 io_thread()->message_loop()->PostTask( | 34 io_thread()->message_loop()->PostTask( |
| 34 FROM_HERE, | 35 FROM_HERE, base::IgnoreReturn<bool>( |
| 35 NewRunnableFunction(&base::ThreadRestrictions::SetIOAllowed, true)); | 36 base::Bind(&base::ThreadRestrictions::SetIOAllowed, true))); |
| 36 | 37 |
| 37 browser_context_.reset(); | 38 browser_context_.reset(); |
| 38 | 39 |
| 39 resource_dispatcher_host_->download_file_manager()->Shutdown(); | 40 resource_dispatcher_host_->download_file_manager()->Shutdown(); |
| 40 resource_dispatcher_host_->save_file_manager()->Shutdown(); | 41 resource_dispatcher_host_->save_file_manager()->Shutdown(); |
| 41 resource_dispatcher_host_->Shutdown(); | 42 resource_dispatcher_host_->Shutdown(); |
| 42 io_thread_.reset(); | 43 io_thread_.reset(); |
| 43 cache_thread_.reset(); | 44 cache_thread_.reset(); |
| 44 process_launcher_thread_.reset(); | 45 process_launcher_thread_.reset(); |
| 45 file_thread_.reset(); | 46 file_thread_.reset(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return resource_dispatcher_host_.get(); | 92 return resource_dispatcher_host_.get(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 ui::Clipboard* ShellBrowserMainParts::GetClipboard() { | 95 ui::Clipboard* ShellBrowserMainParts::GetClipboard() { |
| 95 if (!clipboard_.get()) | 96 if (!clipboard_.get()) |
| 96 clipboard_.reset(new ui::Clipboard()); | 97 clipboard_.reset(new ui::Clipboard()); |
| 97 return clipboard_.get(); | 98 return clipboard_.get(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace | 101 } // namespace |
| OLD | NEW |