Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 PlatformEnableUIControl(BACK_BUTTON, current_index > 0); | 282 PlatformEnableUIControl(BACK_BUTTON, current_index > 0); |
| 283 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); | 283 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); |
| 284 PlatformEnableUIControl(STOP_BUTTON, | 284 PlatformEnableUIControl(STOP_BUTTON, |
| 285 to_different_document && web_contents_->IsLoading()); | 285 to_different_document && web_contents_->IsLoading()); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void Shell::ShowDevTools() { | 288 void Shell::ShowDevTools() { |
| 289 InnerShowDevTools(); | 289 InnerShowDevTools(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void Shell::ShowDevToolsForElementAt(int x, int y) { | |
| 293 InnerShowDevTools(); | |
|
Peter Beverloo
2016/07/20 16:40:14
nit: please inline InnerShowDevTools() in Shell::S
mohsen
2016/07/20 22:16:31
Done.
| |
| 294 devtools_frontend_->InspectElementAt(x, y); | |
| 295 } | |
| 296 | |
| 297 void Shell::CloseDevTools() { | 292 void Shell::CloseDevTools() { |
| 298 if (!devtools_frontend_) | 293 if (!devtools_frontend_) |
| 299 return; | 294 return; |
| 300 devtools_observer_.reset(); | 295 devtools_observer_.reset(); |
| 301 devtools_frontend_->Close(); | 296 devtools_frontend_->Close(); |
| 302 devtools_frontend_ = NULL; | 297 devtools_frontend_ = NULL; |
| 303 } | 298 } |
| 304 | 299 |
| 305 gfx::NativeView Shell::GetContentView() { | 300 gfx::NativeView Shell::GetContentView() { |
| 306 if (!web_contents_) | 301 if (!web_contents_) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 | 426 |
| 432 void Shell::RendererUnresponsive(WebContents* source) { | 427 void Shell::RendererUnresponsive(WebContents* source) { |
| 433 if (switches::IsRunLayoutTestSwitchPresent()) | 428 if (switches::IsRunLayoutTestSwitchPresent()) |
| 434 BlinkTestController::Get()->RendererUnresponsive(); | 429 BlinkTestController::Get()->RendererUnresponsive(); |
| 435 } | 430 } |
| 436 | 431 |
| 437 void Shell::ActivateContents(WebContents* contents) { | 432 void Shell::ActivateContents(WebContents* contents) { |
| 438 contents->GetRenderViewHost()->GetWidget()->Focus(); | 433 contents->GetRenderViewHost()->GetWidget()->Focus(); |
| 439 } | 434 } |
| 440 | 435 |
| 441 bool Shell::HandleContextMenu(const content::ContextMenuParams& params) { | |
| 442 return PlatformHandleContextMenu(params); | |
| 443 } | |
| 444 | |
| 445 gfx::Size Shell::GetShellDefaultSize() { | 436 gfx::Size Shell::GetShellDefaultSize() { |
| 446 static gfx::Size default_shell_size; | 437 static gfx::Size default_shell_size; |
| 447 if (!default_shell_size.IsEmpty()) | 438 if (!default_shell_size.IsEmpty()) |
| 448 return default_shell_size; | 439 return default_shell_size; |
| 449 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 440 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 450 if (command_line->HasSwitch(switches::kContentShellHostWindowSize)) { | 441 if (command_line->HasSwitch(switches::kContentShellHostWindowSize)) { |
| 451 const std::string size_str = command_line->GetSwitchValueASCII( | 442 const std::string size_str = command_line->GetSwitchValueASCII( |
| 452 switches::kContentShellHostWindowSize); | 443 switches::kContentShellHostWindowSize); |
| 453 int width, height; | 444 int width, height; |
| 454 CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height)); | 445 CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height)); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 475 devtools_frontend_->Activate(); | 466 devtools_frontend_->Activate(); |
| 476 devtools_frontend_->Focus(); | 467 devtools_frontend_->Focus(); |
| 477 } | 468 } |
| 478 | 469 |
| 479 void Shell::OnDevToolsWebContentsDestroyed() { | 470 void Shell::OnDevToolsWebContentsDestroyed() { |
| 480 devtools_observer_.reset(); | 471 devtools_observer_.reset(); |
| 481 devtools_frontend_ = NULL; | 472 devtools_frontend_ = NULL; |
| 482 } | 473 } |
| 483 | 474 |
| 484 } // namespace content | 475 } // namespace content |
| OLD | NEW |