| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/keyboard/keyboard_controller_proxy.h" | 5 #include "ui/keyboard/keyboard_controller_proxy.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "content/public/browser/site_instance.h" | 8 #include "content/public/browser/site_instance.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 11 #include "content/public/browser/web_contents_delegate.h" | 11 #include "content/public/browser/web_contents_delegate.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_contents_view.h" | 13 #include "content/public/browser/web_contents_view.h" |
| 14 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
| 15 #include "content/public/common/bindings_policy.h" | 15 #include "content/public/common/bindings_policy.h" |
| 16 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 16 #include "ui/aura/layout_manager.h" | 17 #include "ui/aura/layout_manager.h" |
| 17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 18 #include "ui/keyboard/keyboard_constants.h" | 19 #include "ui/keyboard/keyboard_constants.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // Converts ui::TextInputType to string. | 23 // Converts ui::TextInputType to string. |
| 23 std::string TextInputTypeToString(ui::TextInputType type) { | 24 std::string TextInputTypeToString(ui::TextInputType type) { |
| 24 switch (type) { | 25 switch (type) { |
| 25 case ui::TEXT_INPUT_TYPE_NONE: | 26 case ui::TEXT_INPUT_TYPE_NONE: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 keyboard->SetBounds(bounds); | 89 keyboard->SetBounds(bounds); |
| 89 proxy_->set_resizing_from_contents(false); | 90 proxy_->set_resizing_from_contents(false); |
| 90 } | 91 } |
| 91 | 92 |
| 92 // Overridden from content::WebContentsDelegate: | 93 // Overridden from content::WebContentsDelegate: |
| 93 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, | 94 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, |
| 94 const content::MediaStreamRequest& request, | 95 const content::MediaStreamRequest& request, |
| 95 const content::MediaResponseCallback& callback) OVERRIDE { | 96 const content::MediaResponseCallback& callback) OVERRIDE { |
| 96 proxy_->RequestAudioInput(web_contents, request, callback); | 97 proxy_->RequestAudioInput(web_contents, request, callback); |
| 97 } | 98 } |
| 99 virtual bool PreHandleGestureEvent( |
| 100 content::WebContents* source, |
| 101 const blink::WebGestureEvent& event) OVERRIDE { |
| 102 // Disable pinch zooming. |
| 103 return event.type == blink::WebGestureEvent::GesturePinchBegin || |
| 104 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
| 105 event.type == blink::WebGestureEvent::GesturePinchEnd; |
| 106 } |
| 98 | 107 |
| 99 | 108 |
| 100 // Overridden from content::WebContentsObserver: | 109 // Overridden from content::WebContentsObserver: |
| 101 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE { | 110 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE { |
| 102 delete this; | 111 delete this; |
| 103 } | 112 } |
| 104 | 113 |
| 105 keyboard::KeyboardControllerProxy* proxy_; | 114 keyboard::KeyboardControllerProxy* proxy_; |
| 106 | 115 |
| 107 DISALLOW_COPY_AND_ASSIGN(KeyboardContentsDelegate); | 116 DISALLOW_COPY_AND_ASSIGN(KeyboardContentsDelegate); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 base::DictionaryValue input_context; | 191 base::DictionaryValue input_context; |
| 183 input_context.SetString("type", TextInputTypeToString(type)); | 192 input_context.SetString("type", TextInputTypeToString(type)); |
| 184 webui->CallJavascriptFunction("OnTextInputBoxFocused", input_context); | 193 webui->CallJavascriptFunction("OnTextInputBoxFocused", input_context); |
| 185 } | 194 } |
| 186 } | 195 } |
| 187 | 196 |
| 188 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) { | 197 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) { |
| 189 } | 198 } |
| 190 | 199 |
| 191 } // namespace keyboard | 200 } // namespace keyboard |
| OLD | NEW |