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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 } | 875 } |
876 | 876 |
877 void DevToolsWindow::CloseWindow() { | 877 void DevToolsWindow::CloseWindow() { |
878 DCHECK(is_docked_); | 878 DCHECK(is_docked_); |
879 // This will prevent any activity after frontend is loaded. | 879 // This will prevent any activity after frontend is loaded. |
880 action_on_load_ = DevToolsToggleAction::NoOp(); | 880 action_on_load_ = DevToolsToggleAction::NoOp(); |
881 ignore_set_is_docked_ = true; | 881 ignore_set_is_docked_ = true; |
882 web_contents_->DispatchBeforeUnload(false); | 882 web_contents_->DispatchBeforeUnload(false); |
883 } | 883 } |
884 | 884 |
885 void DevToolsWindow::SetContentsInsets( | 885 void DevToolsWindow::SetInspectedPageBounds(const gfx::Rect& rect) { |
886 int top, int left, int bottom, int right) { | 886 DevToolsContentsResizingStrategy strategy(rect); |
887 gfx::Insets insets(top, left, bottom, right); | 887 if (contents_resizing_strategy_.Equals(strategy)) |
888 SetContentsResizingStrategy(insets, contents_resizing_strategy_.min_size()); | 888 return; |
| 889 |
| 890 contents_resizing_strategy_.CopyFrom(strategy); |
| 891 if (is_docked_) { |
| 892 // Update inspected window. |
| 893 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); |
| 894 if (inspected_window) |
| 895 inspected_window->UpdateDevTools(); |
| 896 } |
889 } | 897 } |
890 | 898 |
891 void DevToolsWindow::SetContentsResizingStrategy( | 899 void DevToolsWindow::SetContentsResizingStrategy( |
892 const gfx::Insets& insets, const gfx::Size& min_size) { | 900 const gfx::Insets& insets, const gfx::Size& min_size) { |
893 DevToolsContentsResizingStrategy strategy(insets, min_size); | 901 DevToolsContentsResizingStrategy strategy(insets, min_size); |
894 if (contents_resizing_strategy_.Equals(strategy)) | 902 if (contents_resizing_strategy_.Equals(strategy)) |
895 return; | 903 return; |
896 | 904 |
897 contents_resizing_strategy_.CopyFrom(strategy); | 905 contents_resizing_strategy_.CopyFrom(strategy); |
898 if (is_docked_) { | 906 if (is_docked_) { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 closure.Run(); | 1176 closure.Run(); |
1169 return; | 1177 return; |
1170 } | 1178 } |
1171 load_completed_callback_ = closure; | 1179 load_completed_callback_ = closure; |
1172 } | 1180 } |
1173 | 1181 |
1174 bool DevToolsWindow::ForwardKeyboardEvent( | 1182 bool DevToolsWindow::ForwardKeyboardEvent( |
1175 const content::NativeWebKeyboardEvent& event) { | 1183 const content::NativeWebKeyboardEvent& event) { |
1176 return event_forwarder_->ForwardEvent(event); | 1184 return event_forwarder_->ForwardEvent(event); |
1177 } | 1185 } |
OLD | NEW |