OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/shell.h" | 5 #include "content/shell/browser/shell.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 void Shell::LoadURLForFrame(const GURL& url, const std::string& frame_name) { | 173 void Shell::LoadURLForFrame(const GURL& url, const std::string& frame_name) { |
174 NavigationController::LoadURLParams params(url); | 174 NavigationController::LoadURLParams params(url); |
175 params.transition_type = PageTransitionFromInt( | 175 params.transition_type = PageTransitionFromInt( |
176 PAGE_TRANSITION_TYPED | PAGE_TRANSITION_FROM_ADDRESS_BAR); | 176 PAGE_TRANSITION_TYPED | PAGE_TRANSITION_FROM_ADDRESS_BAR); |
177 params.frame_name = frame_name; | 177 params.frame_name = frame_name; |
178 web_contents_->GetController().LoadURLWithParams(params); | 178 web_contents_->GetController().LoadURLWithParams(params); |
179 web_contents_->GetView()->Focus(); | 179 web_contents_->GetView()->Focus(); |
180 } | 180 } |
181 | 181 |
| 182 void Shell::LoadDataWithBaseURL(const GURL& url, const std::string& data, |
| 183 const GURL& base_url) { |
| 184 const GURL data_url = GURL("data:text/html;charset=utf-8," + data); |
| 185 NavigationController::LoadURLParams params(data_url); |
| 186 params.load_type = NavigationController::LOAD_TYPE_DATA; |
| 187 params.base_url_for_data_url = base_url; |
| 188 params.virtual_url_for_data_url = url; |
| 189 params.override_user_agent = NavigationController::UA_OVERRIDE_FALSE; |
| 190 web_contents_->GetController().LoadURLWithParams(params); |
| 191 web_contents_->GetView()->Focus(); |
| 192 } |
| 193 |
182 void Shell::AddNewContents(WebContents* source, | 194 void Shell::AddNewContents(WebContents* source, |
183 WebContents* new_contents, | 195 WebContents* new_contents, |
184 WindowOpenDisposition disposition, | 196 WindowOpenDisposition disposition, |
185 const gfx::Rect& initial_pos, | 197 const gfx::Rect& initial_pos, |
186 bool user_gesture, | 198 bool user_gesture, |
187 bool* was_blocked) { | 199 bool* was_blocked) { |
188 CreateShell(new_contents, AdjustWindowSize(initial_pos.size())); | 200 CreateShell(new_contents, AdjustWindowSize(initial_pos.size())); |
189 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 201 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
190 NotifyDoneForwarder::CreateForWebContents(new_contents); | 202 NotifyDoneForwarder::CreateForWebContents(new_contents); |
191 } | 203 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 devtools_frontend_->Activate(); | 387 devtools_frontend_->Activate(); |
376 devtools_frontend_->Focus(); | 388 devtools_frontend_->Focus(); |
377 } | 389 } |
378 | 390 |
379 void Shell::OnDevToolsWebContentsDestroyed() { | 391 void Shell::OnDevToolsWebContentsDestroyed() { |
380 devtools_observer_.reset(); | 392 devtools_observer_.reset(); |
381 devtools_frontend_ = NULL; | 393 devtools_frontend_ = NULL; |
382 } | 394 } |
383 | 395 |
384 } // namespace content | 396 } // namespace content |
OLD | NEW |