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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 } | 821 } |
822 | 822 |
823 void DevToolsWindow::ActivateContents(WebContents* contents, | 823 void DevToolsWindow::ActivateContents(WebContents* contents, |
824 bool user_gesture) { | 824 bool user_gesture) { |
825 if (is_docked_) { | 825 if (is_docked_) { |
826 WebContents* inspected_tab = GetInspectedWebContents(); | 826 WebContents* inspected_tab = GetInspectedWebContents(); |
827 if (inspected_tab) | 827 if (inspected_tab) |
828 inspected_tab->GetDelegate()->ActivateContents(inspected_tab, | 828 inspected_tab->GetDelegate()->ActivateContents(inspected_tab, |
829 true /* user_gesture */); | 829 true /* user_gesture */); |
830 } else if (browser_) { | 830 } else if (browser_) { |
831 browser_->window()->Activate(); | 831 browser_->window()->Activate(true /* user_gesture */); |
832 } | 832 } |
833 } | 833 } |
834 | 834 |
835 void DevToolsWindow::AddNewContents(WebContents* source, | 835 void DevToolsWindow::AddNewContents(WebContents* source, |
836 WebContents* new_contents, | 836 WebContents* new_contents, |
837 WindowOpenDisposition disposition, | 837 WindowOpenDisposition disposition, |
838 const gfx::Rect& initial_rect, | 838 const gfx::Rect& initial_rect, |
839 bool user_gesture, | 839 bool user_gesture, |
840 bool* was_blocked) { | 840 bool* was_blocked) { |
841 if (new_contents == toolbox_web_contents_) { | 841 if (new_contents == toolbox_web_contents_) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 event.type == blink::WebGestureEvent::GesturePinchUpdate || | 966 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
967 event.type == blink::WebGestureEvent::GesturePinchEnd; | 967 event.type == blink::WebGestureEvent::GesturePinchEnd; |
968 } | 968 } |
969 | 969 |
970 void DevToolsWindow::ActivateWindow() { | 970 void DevToolsWindow::ActivateWindow() { |
971 if (life_stage_ != kLoadCompleted) | 971 if (life_stage_ != kLoadCompleted) |
972 return; | 972 return; |
973 if (is_docked_ && GetInspectedBrowserWindow()) | 973 if (is_docked_ && GetInspectedBrowserWindow()) |
974 main_web_contents_->Focus(); | 974 main_web_contents_->Focus(); |
975 else if (!is_docked_ && !browser_->window()->IsActive()) | 975 else if (!is_docked_ && !browser_->window()->IsActive()) |
976 browser_->window()->Activate(); | 976 browser_->window()->Activate(true /* user_gesture */); |
977 } | 977 } |
978 | 978 |
979 void DevToolsWindow::CloseWindow() { | 979 void DevToolsWindow::CloseWindow() { |
980 DCHECK(is_docked_); | 980 DCHECK(is_docked_); |
981 life_stage_ = kClosing; | 981 life_stage_ = kClosing; |
982 main_web_contents_->DispatchBeforeUnload(false); | 982 main_web_contents_->DispatchBeforeUnload(false); |
983 } | 983 } |
984 | 984 |
985 void DevToolsWindow::SetInspectedPageBounds(const gfx::Rect& rect) { | 985 void DevToolsWindow::SetInspectedPageBounds(const gfx::Rect& rect) { |
986 DevToolsContentsResizingStrategy strategy(rect); | 986 DevToolsContentsResizingStrategy strategy(rect); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 closure.Run(); | 1205 closure.Run(); |
1206 return; | 1206 return; |
1207 } | 1207 } |
1208 load_completed_callback_ = closure; | 1208 load_completed_callback_ = closure; |
1209 } | 1209 } |
1210 | 1210 |
1211 bool DevToolsWindow::ForwardKeyboardEvent( | 1211 bool DevToolsWindow::ForwardKeyboardEvent( |
1212 const content::NativeWebKeyboardEvent& event) { | 1212 const content::NativeWebKeyboardEvent& event) { |
1213 return event_forwarder_->ForwardEvent(event); | 1213 return event_forwarder_->ForwardEvent(event); |
1214 } | 1214 } |
OLD | NEW |