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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 : profile_(profile), | 82 : profile_(profile), |
83 extension_(extension), | 83 extension_(extension), |
84 ALLOW_THIS_IN_INITIALIZER_LIST( | 84 ALLOW_THIS_IN_INITIALIZER_LIST( |
85 extension_function_dispatcher_(profile, this)) { | 85 extension_function_dispatcher_(profile, this)) { |
86 // TODO(jeremya) this should all be done in an Init() method, not in the | 86 // TODO(jeremya) this should all be done in an Init() method, not in the |
87 // constructor. During this code, WebContents will be calling | 87 // constructor. During this code, WebContents will be calling |
88 // WebContentsDelegate methods, but at this point the vftables for the | 88 // WebContentsDelegate methods, but at this point the vftables for the |
89 // subclass are not yet in place, since it's still halfway through its | 89 // subclass are not yet in place, since it's still halfway through its |
90 // constructor. As a result, overridden virtual methods won't be called. | 90 // constructor. As a result, overridden virtual methods won't be called. |
91 web_contents_ = WebContents::Create( | 91 web_contents_ = WebContents::Create( |
92 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL, | 92 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, |
93 NULL); | 93 NULL); |
94 contents_.reset(new TabContents(web_contents_)); | 94 contents_.reset(new TabContents(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 // Block the created RVH from loading anything until the background page | 102 // Block the created RVH from loading anything until the background page |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 extension_function_dispatcher_.Dispatch(params, | 354 extension_function_dispatcher_.Dispatch(params, |
355 web_contents_->GetRenderViewHost()); | 355 web_contents_->GetRenderViewHost()); |
356 } | 356 } |
357 | 357 |
358 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, | 358 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, |
359 const std::string& message) { | 359 const std::string& message) { |
360 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); | 360 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); |
361 rvh->Send(new ExtensionMsg_AddMessageToConsole( | 361 rvh->Send(new ExtensionMsg_AddMessageToConsole( |
362 rvh->GetRoutingID(), level, message)); | 362 rvh->GetRoutingID(), level, message)); |
363 } | 363 } |
OLD | NEW |