OLD | NEW |
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 "chrome/browser/ui/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
9 #include "chrome/browser/extensions/shell_window_registry.h" | 9 #include "chrome/browser/extensions/shell_window_registry.h" |
10 #include "chrome/browser/file_select_helper.h" | 10 #include "chrome/browser/file_select_helper.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 web_contents_(NULL), | 84 web_contents_(NULL), |
85 ALLOW_THIS_IN_INITIALIZER_LIST( | 85 ALLOW_THIS_IN_INITIALIZER_LIST( |
86 extension_function_dispatcher_(profile, this)) { | 86 extension_function_dispatcher_(profile, this)) { |
87 } | 87 } |
88 | 88 |
89 void ShellWindow::Init(const GURL& url, | 89 void ShellWindow::Init(const GURL& url, |
90 const ShellWindow::CreateParams& params) { | 90 const ShellWindow::CreateParams& params) { |
91 web_contents_ = WebContents::Create( | 91 web_contents_ = WebContents::Create( |
92 profile(), SiteInstance::CreateForURL(profile(), url), MSG_ROUTING_NONE, | 92 profile(), SiteInstance::CreateForURL(profile(), url), MSG_ROUTING_NONE, |
93 NULL); | 93 NULL); |
94 contents_.reset(new TabContents(web_contents_)); | 94 contents_.reset(TabContents::Factory::CreateTabContents(web_contents_)); |
95 content::WebContentsObserver::Observe(web_contents_); | 95 content::WebContentsObserver::Observe(web_contents_); |
96 web_contents_->SetDelegate(this); | 96 web_contents_->SetDelegate(this); |
97 chrome::SetViewType(web_contents_, chrome::VIEW_TYPE_APP_SHELL); | 97 chrome::SetViewType(web_contents_, chrome::VIEW_TYPE_APP_SHELL); |
98 web_contents_->GetMutableRendererPrefs()-> | 98 web_contents_->GetMutableRendererPrefs()-> |
99 browser_handles_all_top_level_requests = true; | 99 browser_handles_all_top_level_requests = true; |
100 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 100 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
101 | 101 |
102 native_window_.reset(NativeShellWindow::Create(this, params)); | 102 native_window_.reset(NativeShellWindow::Create(this, params)); |
103 | 103 |
104 // Block the created RVH from loading anything until the background page | 104 // Block the created RVH from loading anything until the background page |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 extension_function_dispatcher_.Dispatch(params, | 369 extension_function_dispatcher_.Dispatch(params, |
370 web_contents_->GetRenderViewHost()); | 370 web_contents_->GetRenderViewHost()); |
371 } | 371 } |
372 | 372 |
373 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, | 373 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, |
374 const std::string& message) { | 374 const std::string& message) { |
375 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); | 375 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); |
376 rvh->Send(new ExtensionMsg_AddMessageToConsole( | 376 rvh->Send(new ExtensionMsg_AddMessageToConsole( |
377 rvh->GetRoutingID(), level, message)); | 377 rvh->GetRoutingID(), level, message)); |
378 } | 378 } |
OLD | NEW |