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

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

Issue 7906008: Create a very simple TabContentsView (and not fully implemented yet) and add more supporting code... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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/message_loop.h"
8 #include "base/threading/thread.h"
9 #include "base/threading/thread_restrictions.h"
10 #include "content/browser/browser_process_sub_thread.h"
11 #include "content/browser/renderer_host/resource_dispatcher_host.h"
12 #include "content/browser/tab_contents/tab_contents.h"
13 #include "content/browser/tab_contents/navigation_controller.h"
14 #include "content/common/page_transition_types.h"
15 #include "content/shell/shell_browser_context.h"
16 #include "content/shell/shell_content_browser_client.h"
17 #include "ui/base/clipboard/clipboard.h"
18
19 namespace content {
20
21 ShellBrowserMainParts::ShellBrowserMainParts(
22 const MainFunctionParams& parameters)
23 : BrowserMainParts(parameters) {
24 ShellContentBrowserClient* shell_browser_client =
25 static_cast<ShellContentBrowserClient*>(
26 content::GetContentClient()->browser());
27 shell_browser_client->set_shell_browser_main_parts(this);
28 }
29
30 ShellBrowserMainParts::~ShellBrowserMainParts() {
31 base::ThreadRestrictions::SetIOAllowed(true);
32 io_thread()->message_loop()->PostTask(
33 FROM_HERE,
34 NewRunnableFunction(&base::ThreadRestrictions::SetIOAllowed, true));
35
36 resource_dispatcher_host_->Shutdown();
37 io_thread_.reset();
38 cache_thread_.reset();
39 process_launcher_thread_.reset();
40 file_thread_.reset();
41 resource_dispatcher_host_.reset(); // Kills WebKit thread.
42 db_thread_.reset();
43 }
44
45 void ShellBrowserMainParts::PreMainMessageLoopRun() {
46 db_thread_.reset(new BrowserProcessSubThread(BrowserThread::DB));
47 db_thread_->Start();
48 file_thread_.reset(new BrowserProcessSubThread(BrowserThread::FILE));
49 file_thread_->Start();
50 process_launcher_thread_.reset(
51 new BrowserProcessSubThread(BrowserThread::PROCESS_LAUNCHER));
52 process_launcher_thread_->Start();
53
54 base::Thread::Options options;
55 options.message_loop_type = MessageLoop::TYPE_IO;
56
57 cache_thread_.reset(new BrowserProcessSubThread(BrowserThread::CACHE));
58 cache_thread_->StartWithOptions(options);
59 io_thread_.reset(new BrowserProcessSubThread(BrowserThread::IO));
60 io_thread_->StartWithOptions(options);
61
62 browser_context_.reset(new ShellBrowserContext(this));
63
64 tab_contents_.reset(new TabContents(
65 browser_context_.get(),
66 NULL,
67 MSG_ROUTING_NONE,
68 NULL,
69 NULL));
70 tab_contents_->controller().LoadURL(
71 GURL("http://www.google.com"),
72 GURL(),
73 PageTransition::TYPED,
74 std::string());
75 }
76
77 ResourceDispatcherHost* ShellBrowserMainParts::GetResourceDispatcherHost() {
78 if (!resource_dispatcher_host_.get()) {
79 ResourceQueue::DelegateSet resource_queue_delegates;
80 resource_dispatcher_host_.reset(
81 new ResourceDispatcherHost(resource_queue_delegates));
82 }
83 return resource_dispatcher_host_.get();
84 }
85
86 ui::Clipboard* ShellBrowserMainParts::GetClipboard() {
87 if (!clipboard_.get())
88 clipboard_.reset(new ui::Clipboard());
89 return clipboard_.get();
90 }
91
92 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698