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/devtools/devtools_window.h" | 5 #include "chrome/browser/devtools/devtools_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 // This will prevent any activity after frontend is loaded. | 485 // This will prevent any activity after frontend is loaded. |
486 action_on_load_ = DevToolsToggleAction::NoOp(); | 486 action_on_load_ = DevToolsToggleAction::NoOp(); |
487 ignore_set_is_docked_ = true; | 487 ignore_set_is_docked_ = true; |
488 web_contents_->GetRenderViewHost()->ClosePage(); | 488 web_contents_->GetRenderViewHost()->ClosePage(); |
489 } | 489 } |
490 | 490 |
491 content::RenderViewHost* DevToolsWindow::GetRenderViewHost() { | 491 content::RenderViewHost* DevToolsWindow::GetRenderViewHost() { |
492 return web_contents_->GetRenderViewHost(); | 492 return web_contents_->GetRenderViewHost(); |
493 } | 493 } |
494 | 494 |
495 gfx::Insets DevToolsWindow::GetContentsInsets() const { | 495 const DevToolsContentsResizingStrategy& |
496 return contents_insets_; | 496 DevToolsWindow::GetContentsResizingStrategy() const { |
| 497 return contents_resizing_strategy_; |
497 } | 498 } |
498 | 499 |
499 gfx::Size DevToolsWindow::GetMinimumSize() const { | 500 gfx::Size DevToolsWindow::GetMinimumSize() const { |
500 const gfx::Size kMinDevToolsSize = gfx::Size(230, 100); | 501 const gfx::Size kMinDevToolsSize = gfx::Size(230, 100); |
501 return kMinDevToolsSize; | 502 return kMinDevToolsSize; |
502 } | 503 } |
503 | 504 |
504 void DevToolsWindow::ScheduleShow(const DevToolsToggleAction& action) { | 505 void DevToolsWindow::ScheduleShow(const DevToolsToggleAction& action) { |
505 if (load_state_ == kLoadCompleted) { | 506 if (load_state_ == kLoadCompleted) { |
506 Show(action); | 507 Show(action); |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 void DevToolsWindow::CloseWindow() { | 991 void DevToolsWindow::CloseWindow() { |
991 DCHECK(is_docked_); | 992 DCHECK(is_docked_); |
992 // This will prevent any activity after frontend is loaded. | 993 // This will prevent any activity after frontend is loaded. |
993 action_on_load_ = DevToolsToggleAction::NoOp(); | 994 action_on_load_ = DevToolsToggleAction::NoOp(); |
994 ignore_set_is_docked_ = true; | 995 ignore_set_is_docked_ = true; |
995 web_contents_->GetRenderViewHost()->FirePageBeforeUnload(false); | 996 web_contents_->GetRenderViewHost()->FirePageBeforeUnload(false); |
996 } | 997 } |
997 | 998 |
998 void DevToolsWindow::SetContentsInsets( | 999 void DevToolsWindow::SetContentsInsets( |
999 int top, int left, int bottom, int right) { | 1000 int top, int left, int bottom, int right) { |
1000 if (contents_insets_.top() == top && | 1001 gfx::Insets insets(top, left, bottom, right); |
1001 contents_insets_.left() == left && | 1002 SetContentsResizingStrategy(insets, contents_resizing_strategy_.min_size()); |
1002 contents_insets_.bottom() == bottom && | 1003 } |
1003 contents_insets_.right() == right) { | 1004 |
| 1005 void DevToolsWindow::SetContentsResizingStrategy( |
| 1006 const gfx::Insets& insets, const gfx::Size& min_size) { |
| 1007 DevToolsContentsResizingStrategy strategy(insets, min_size); |
| 1008 if (contents_resizing_strategy_.Equals(strategy)) |
1004 return; | 1009 return; |
1005 } | |
1006 | 1010 |
1007 contents_insets_ = gfx::Insets(top, left, bottom, right); | 1011 contents_resizing_strategy_.CopyFrom(strategy); |
1008 if (is_docked_) { | 1012 if (is_docked_) { |
1009 // Update inspected window. | 1013 // Update inspected window. |
1010 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); | 1014 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); |
1011 if (inspected_window) | 1015 if (inspected_window) |
1012 inspected_window->UpdateDevTools(); | 1016 inspected_window->UpdateDevTools(); |
1013 } | 1017 } |
1014 } | 1018 } |
1015 | 1019 |
1016 void DevToolsWindow::InspectElementCompleted() { | 1020 void DevToolsWindow::InspectElementCompleted() { |
1017 if (!inspect_element_start_time_.is_null()) { | 1021 if (!inspect_element_start_time_.is_null()) { |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 if (load_state_ == kLoadCompleted) | 1502 if (load_state_ == kLoadCompleted) |
1499 LoadCompleted(); | 1503 LoadCompleted(); |
1500 } | 1504 } |
1501 | 1505 |
1502 void DevToolsWindow::LoadCompleted() { | 1506 void DevToolsWindow::LoadCompleted() { |
1503 Show(action_on_load_); | 1507 Show(action_on_load_); |
1504 action_on_load_ = DevToolsToggleAction::NoOp(); | 1508 action_on_load_ = DevToolsToggleAction::NoOp(); |
1505 UpdateTheme(); | 1509 UpdateTheme(); |
1506 AddDevToolsExtensionsToClient(); | 1510 AddDevToolsExtensionsToClient(); |
1507 } | 1511 } |
OLD | NEW |