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 "content/browser/web_contents/touch_editable_impl_aura.h" | 5 #include "content/browser/web_contents/touch_editable_impl_aura.h" |
6 | 6 |
7 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "content/public/browser/render_widget_host.h" | 10 #include "content/public/browser/render_widget_host.h" |
11 #include "grit/ui_strings.h" | 11 #include "grit/ui_strings.h" |
12 #include "ui/aura/client/activation_client.h" | 12 #include "ui/aura/client/activation_client.h" |
13 #include "ui/aura/client/screen_position_client.h" | 13 #include "ui/aura/client/screen_position_client.h" |
14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
16 #include "ui/base/clipboard/clipboard.h" | 16 #include "ui/base/clipboard/clipboard.h" |
17 #include "ui/base/range/range.h" | |
18 #include "ui/base/ui_base_switches_util.h" | 17 #include "ui/base/ui_base_switches_util.h" |
| 18 #include "ui/gfx/range/range.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
23 // TouchEditableImplAura, public: | 23 // TouchEditableImplAura, public: |
24 | 24 |
25 TouchEditableImplAura::~TouchEditableImplAura() { | 25 TouchEditableImplAura::~TouchEditableImplAura() { |
26 Cleanup(); | 26 Cleanup(); |
27 } | 27 } |
28 | 28 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 bool TouchEditableImplAura::IsCommandIdChecked(int command_id) const { | 289 bool TouchEditableImplAura::IsCommandIdChecked(int command_id) const { |
290 NOTREACHED(); | 290 NOTREACHED(); |
291 return false; | 291 return false; |
292 } | 292 } |
293 | 293 |
294 bool TouchEditableImplAura::IsCommandIdEnabled(int command_id) const { | 294 bool TouchEditableImplAura::IsCommandIdEnabled(int command_id) const { |
295 if (!rwhva_) | 295 if (!rwhva_) |
296 return false; | 296 return false; |
297 bool editable = rwhva_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 297 bool editable = rwhva_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
298 ui::Range selection_range; | 298 gfx::Range selection_range; |
299 rwhva_->GetSelectionRange(&selection_range); | 299 rwhva_->GetSelectionRange(&selection_range); |
300 bool has_selection = !selection_range.is_empty(); | 300 bool has_selection = !selection_range.is_empty(); |
301 switch (command_id) { | 301 switch (command_id) { |
302 case IDS_APP_CUT: | 302 case IDS_APP_CUT: |
303 return editable && has_selection; | 303 return editable && has_selection; |
304 case IDS_APP_COPY: | 304 case IDS_APP_COPY: |
305 return has_selection; | 305 return has_selection; |
306 case IDS_APP_PASTE: { | 306 case IDS_APP_PASTE: { |
307 string16 result; | 307 string16 result; |
308 ui::Clipboard::GetForCurrentThread()->ReadText( | 308 ui::Clipboard::GetForCurrentThread()->ReadText( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 rwhva_ = NULL; | 370 rwhva_ = NULL; |
371 } | 371 } |
372 text_input_type_ = ui::TEXT_INPUT_TYPE_NONE; | 372 text_input_type_ = ui::TEXT_INPUT_TYPE_NONE; |
373 touch_selection_controller_.reset(); | 373 touch_selection_controller_.reset(); |
374 handles_hidden_due_to_scroll_ = false; | 374 handles_hidden_due_to_scroll_ = false; |
375 scroll_in_progress_ = false; | 375 scroll_in_progress_ = false; |
376 overscroll_in_progress_ = false; | 376 overscroll_in_progress_ = false; |
377 } | 377 } |
378 | 378 |
379 } // namespace content | 379 } // namespace content |
OLD | NEW |