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 #include <algorithm> | 6 #include <algorithm> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "content/public/browser/user_metrics.h" | 59 #include "content/public/browser/user_metrics.h" |
60 #include "content/public/browser/web_contents.h" | 60 #include "content/public/browser/web_contents.h" |
61 #include "content/public/browser/web_contents_observer.h" | 61 #include "content/public/browser/web_contents_observer.h" |
62 #include "content/public/browser/web_contents_view.h" | 62 #include "content/public/browser/web_contents_view.h" |
63 #include "content/public/common/bindings_policy.h" | 63 #include "content/public/common/bindings_policy.h" |
64 #include "content/public/common/content_client.h" | 64 #include "content/public/common/content_client.h" |
65 #include "content/public/common/page_transition_types.h" | 65 #include "content/public/common/page_transition_types.h" |
66 #include "content/public/common/url_constants.h" | 66 #include "content/public/common/url_constants.h" |
67 #include "extensions/common/extension_set.h" | 67 #include "extensions/common/extension_set.h" |
68 #include "grit/generated_resources.h" | 68 #include "grit/generated_resources.h" |
| 69 #include "third_party/WebKit/public/web/WebInputEvent.h" |
69 #include "ui/base/l10n/l10n_util.h" | 70 #include "ui/base/l10n/l10n_util.h" |
70 | 71 |
71 using base::DictionaryValue; | 72 using base::DictionaryValue; |
72 using content::BrowserThread; | 73 using content::BrowserThread; |
73 using content::DevToolsAgentHost; | 74 using content::DevToolsAgentHost; |
74 | 75 |
75 | 76 |
76 // DevToolsConfirmInfoBarDelegate --------------------------------------------- | 77 // DevToolsConfirmInfoBarDelegate --------------------------------------------- |
77 | 78 |
78 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { | 79 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 | 933 |
933 void DevToolsWindow::WebContentsFocused(content::WebContents* contents) { | 934 void DevToolsWindow::WebContentsFocused(content::WebContents* contents) { |
934 Browser* inspected_browser = NULL; | 935 Browser* inspected_browser = NULL; |
935 int inspected_tab_index = -1; | 936 int inspected_tab_index = -1; |
936 if (is_docked_ && FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), | 937 if (is_docked_ && FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), |
937 &inspected_browser, | 938 &inspected_browser, |
938 &inspected_tab_index)) | 939 &inspected_tab_index)) |
939 inspected_browser->window()->WebContentsFocused(contents); | 940 inspected_browser->window()->WebContentsFocused(contents); |
940 } | 941 } |
941 | 942 |
| 943 bool DevToolsWindow::PreHandleGestureEvent( |
| 944 content::WebContents* source, |
| 945 const blink::WebGestureEvent& event) { |
| 946 // Disable pinch zooming. |
| 947 return event.type == blink::WebGestureEvent::GesturePinchBegin || |
| 948 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
| 949 event.type == blink::WebGestureEvent::GesturePinchEnd; |
| 950 } |
| 951 |
942 void DevToolsWindow::DispatchOnEmbedder(const std::string& message) { | 952 void DevToolsWindow::DispatchOnEmbedder(const std::string& message) { |
943 std::string method; | 953 std::string method; |
944 base::ListValue empty_params; | 954 base::ListValue empty_params; |
945 base::ListValue* params = &empty_params; | 955 base::ListValue* params = &empty_params; |
946 | 956 |
947 base::DictionaryValue* dict = NULL; | 957 base::DictionaryValue* dict = NULL; |
948 scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message)); | 958 scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message)); |
949 if (!parsed_message || | 959 if (!parsed_message || |
950 !parsed_message->GetAsDictionary(&dict) || | 960 !parsed_message->GetAsDictionary(&dict) || |
951 !dict->GetString(kFrontendHostMethod, &method) || | 961 !dict->GetString(kFrontendHostMethod, &method) || |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 if (load_state_ == kLoadCompleted) | 1497 if (load_state_ == kLoadCompleted) |
1488 LoadCompleted(); | 1498 LoadCompleted(); |
1489 } | 1499 } |
1490 | 1500 |
1491 void DevToolsWindow::LoadCompleted() { | 1501 void DevToolsWindow::LoadCompleted() { |
1492 Show(action_on_load_); | 1502 Show(action_on_load_); |
1493 action_on_load_ = DevToolsToggleAction::NoOp(); | 1503 action_on_load_ = DevToolsToggleAction::NoOp(); |
1494 UpdateTheme(); | 1504 UpdateTheme(); |
1495 AddDevToolsExtensionsToClient(); | 1505 AddDevToolsExtensionsToClient(); |
1496 } | 1506 } |
OLD | NEW |