| 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 "content/shell/shell.h" | 5 #include "content/shell/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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 return; | 201 return; |
| 202 registrar_.Remove(this, | 202 registrar_.Remove(this, |
| 203 NOTIFICATION_WEB_CONTENTS_DESTROYED, | 203 NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 204 Source<WebContents>( | 204 Source<WebContents>( |
| 205 devtools_frontend_->frontend_shell()->web_contents())); | 205 devtools_frontend_->frontend_shell()->web_contents())); |
| 206 devtools_frontend_->Close(); | 206 devtools_frontend_->Close(); |
| 207 devtools_frontend_ = NULL; | 207 devtools_frontend_ = NULL; |
| 208 } | 208 } |
| 209 | 209 |
| 210 gfx::NativeView Shell::GetContentView() { | 210 gfx::NativeView Shell::GetContentView() { |
| 211 if (!web_contents_.get()) | 211 if (!web_contents_) |
| 212 return NULL; | 212 return NULL; |
| 213 return web_contents_->GetView()->GetNativeView(); | 213 return web_contents_->GetView()->GetNativeView(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 WebContents* Shell::OpenURLFromTab(WebContents* source, | 216 WebContents* Shell::OpenURLFromTab(WebContents* source, |
| 217 const OpenURLParams& params) { | 217 const OpenURLParams& params) { |
| 218 // The only one we implement for now. | 218 // The only one we implement for now. |
| 219 DCHECK(params.disposition == CURRENT_TAB); | 219 DCHECK(params.disposition == CURRENT_TAB); |
| 220 source->GetController().LoadURL( | 220 source->GetController().LoadURL( |
| 221 params.url, params.referrer, params.transition, std::string()); | 221 params.url, params.referrer, params.transition, std::string()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 CreateShell(new_contents); | 274 CreateShell(new_contents); |
| 275 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 275 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 276 NotifyDoneForwarder::CreateForWebContents(new_contents); | 276 NotifyDoneForwarder::CreateForWebContents(new_contents); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void Shell::DidNavigateMainFramePostCommit(WebContents* web_contents) { | 279 void Shell::DidNavigateMainFramePostCommit(WebContents* web_contents) { |
| 280 PlatformSetAddressBarURL(web_contents->GetURL()); | 280 PlatformSetAddressBarURL(web_contents->GetURL()); |
| 281 } | 281 } |
| 282 | 282 |
| 283 JavaScriptDialogManager* Shell::GetJavaScriptDialogManager() { | 283 JavaScriptDialogManager* Shell::GetJavaScriptDialogManager() { |
| 284 if (!dialog_manager_.get()) | 284 if (!dialog_manager_) |
| 285 dialog_manager_.reset(new ShellJavaScriptDialogManager()); | 285 dialog_manager_.reset(new ShellJavaScriptDialogManager()); |
| 286 return dialog_manager_.get(); | 286 return dialog_manager_.get(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 bool Shell::AddMessageToConsole(WebContents* source, | 289 bool Shell::AddMessageToConsole(WebContents* source, |
| 290 int32 level, | 290 int32 level, |
| 291 const string16& message, | 291 const string16& message, |
| 292 int32 line_no, | 292 int32 line_no, |
| 293 const string16& source_id) { | 293 const string16& source_id) { |
| 294 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree); | 294 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 321 } | 321 } |
| 322 } else if (type == NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 322 } else if (type == NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 323 devtools_frontend_ = NULL; | 323 devtools_frontend_ = NULL; |
| 324 registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, source); | 324 registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, source); |
| 325 } else { | 325 } else { |
| 326 NOTREACHED(); | 326 NOTREACHED(); |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace content | 330 } // namespace content |
| OLD | NEW |