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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 | 924 |
924 void DevToolsWindow::WebContentsFocused(content::WebContents* contents) { | 925 void DevToolsWindow::WebContentsFocused(content::WebContents* contents) { |
925 Browser* inspected_browser = NULL; | 926 Browser* inspected_browser = NULL; |
926 int inspected_tab_index = -1; | 927 int inspected_tab_index = -1; |
927 if (is_docked_ && FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), | 928 if (is_docked_ && FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), |
928 &inspected_browser, | 929 &inspected_browser, |
929 &inspected_tab_index)) | 930 &inspected_tab_index)) |
930 inspected_browser->window()->WebContentsFocused(contents); | 931 inspected_browser->window()->WebContentsFocused(contents); |
931 } | 932 } |
932 | 933 |
| 934 bool DevToolsWindow::PreHandleGestureEvent( |
| 935 content::WebContents* source, |
| 936 const blink::WebGestureEvent& event) { |
| 937 // Disable pinch zooming. |
| 938 return event.type == blink::WebGestureEvent::GesturePinchBegin || |
| 939 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
| 940 event.type == blink::WebGestureEvent::GesturePinchEnd; |
| 941 } |
| 942 |
933 void DevToolsWindow::DispatchOnEmbedder(const std::string& message) { | 943 void DevToolsWindow::DispatchOnEmbedder(const std::string& message) { |
934 std::string method; | 944 std::string method; |
935 base::ListValue empty_params; | 945 base::ListValue empty_params; |
936 base::ListValue* params = &empty_params; | 946 base::ListValue* params = &empty_params; |
937 | 947 |
938 base::DictionaryValue* dict = NULL; | 948 base::DictionaryValue* dict = NULL; |
939 scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message)); | 949 scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message)); |
940 if (!parsed_message || | 950 if (!parsed_message || |
941 !parsed_message->GetAsDictionary(&dict) || | 951 !parsed_message->GetAsDictionary(&dict) || |
942 !dict->GetString(kFrontendHostMethod, &method) || | 952 !dict->GetString(kFrontendHostMethod, &method) || |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 if (load_state_ == kLoadCompleted) | 1483 if (load_state_ == kLoadCompleted) |
1474 LoadCompleted(); | 1484 LoadCompleted(); |
1475 } | 1485 } |
1476 | 1486 |
1477 void DevToolsWindow::LoadCompleted() { | 1487 void DevToolsWindow::LoadCompleted() { |
1478 Show(action_on_load_); | 1488 Show(action_on_load_); |
1479 action_on_load_ = DevToolsToggleAction::NoOp(); | 1489 action_on_load_ = DevToolsToggleAction::NoOp(); |
1480 UpdateTheme(); | 1490 UpdateTheme(); |
1481 AddDevToolsExtensionsToClient(); | 1491 AddDevToolsExtensionsToClient(); |
1482 } | 1492 } |
OLD | NEW |