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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/public/browser/site_instance.h" | 9 #include "content/public/browser/site_instance.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 virtual void MoveContents(content::WebContents* source, | 50 virtual void MoveContents(content::WebContents* source, |
51 const gfx::Rect& pos) OVERRIDE { | 51 const gfx::Rect& pos) OVERRIDE { |
52 aura::Window* keyboard = proxy_->GetKeyboardWindow(); | 52 aura::Window* keyboard = proxy_->GetKeyboardWindow(); |
53 gfx::Rect bounds = keyboard->bounds(); | 53 gfx::Rect bounds = keyboard->bounds(); |
54 int new_height = pos.height(); | 54 int new_height = pos.height(); |
55 bounds.set_y(bounds.y() + bounds.height() - new_height); | 55 bounds.set_y(bounds.y() + bounds.height() - new_height); |
56 bounds.set_height(new_height); | 56 bounds.set_height(new_height); |
57 proxy_->set_resizing_from_contents(true); | |
58 keyboard->SetBounds(bounds); | 57 keyboard->SetBounds(bounds); |
59 proxy_->set_resizing_from_contents(false); | |
60 } | 58 } |
61 | 59 |
62 // Overridden from content::WebContentsDelegate: | 60 // Overridden from content::WebContentsDelegate: |
63 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, | 61 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, |
64 const content::MediaStreamRequest& request, | 62 const content::MediaStreamRequest& request, |
65 const content::MediaResponseCallback& callback) OVERRIDE { | 63 const content::MediaResponseCallback& callback) OVERRIDE { |
66 proxy_->RequestAudioInput(web_contents, request, callback); | 64 proxy_->RequestAudioInput(web_contents, request, callback); |
67 } | 65 } |
68 | 66 |
69 // Overridden from content::WebContentsObserver: | 67 // Overridden from content::WebContentsObserver: |
70 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE { | 68 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE { |
71 delete this; | 69 delete this; |
72 } | 70 } |
73 | 71 |
74 keyboard::KeyboardControllerProxy* proxy_; | 72 keyboard::KeyboardControllerProxy* proxy_; |
75 | 73 |
76 DISALLOW_COPY_AND_ASSIGN(KeyboardContentsDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(KeyboardContentsDelegate); |
77 }; | 75 }; |
78 | 76 |
79 } // namespace | 77 } // namespace |
80 | 78 |
81 namespace keyboard { | 79 namespace keyboard { |
82 | 80 |
83 KeyboardControllerProxy::KeyboardControllerProxy() | 81 KeyboardControllerProxy::KeyboardControllerProxy() |
84 : default_url_(kKeyboardURL), resizing_from_contents_(false) { | 82 : default_url_(kKeyboardURL) { |
85 } | 83 } |
86 | 84 |
87 KeyboardControllerProxy::~KeyboardControllerProxy() { | 85 KeyboardControllerProxy::~KeyboardControllerProxy() { |
88 } | 86 } |
89 | 87 |
90 const GURL& KeyboardControllerProxy::GetVirtualKeyboardUrl() { | 88 const GURL& KeyboardControllerProxy::GetVirtualKeyboardUrl() { |
91 if (keyboard::IsInputViewEnabled()) { | 89 if (keyboard::IsInputViewEnabled()) { |
92 const GURL& override_url = GetOverrideContentUrl(); | 90 const GURL& override_url = GetOverrideContentUrl(); |
93 return override_url.is_valid() ? override_url : default_url_; | 91 return override_url.is_valid() ? override_url : default_url_; |
94 } else { | 92 } else { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 DCHECK(keyboard_contents_); | 154 DCHECK(keyboard_contents_); |
157 if (keyboard_contents_->GetURL() != GetVirtualKeyboardUrl()) { | 155 if (keyboard_contents_->GetURL() != GetVirtualKeyboardUrl()) { |
158 LoadContents(GetVirtualKeyboardUrl()); | 156 LoadContents(GetVirtualKeyboardUrl()); |
159 } | 157 } |
160 } | 158 } |
161 | 159 |
162 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) { | 160 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) { |
163 } | 161 } |
164 | 162 |
165 } // namespace keyboard | 163 } // namespace keyboard |
OLD | NEW |