| 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 "base/command_line.h" | |
| 8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 9 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 10 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
| 11 #include "content/public/browser/render_widget_host.h" | 10 #include "content/public/browser/render_widget_host.h" |
| 12 #include "grit/ui_strings.h" | 11 #include "grit/ui_strings.h" |
| 13 #include "ui/aura/client/activation_client.h" | 12 #include "ui/aura/client/activation_client.h" |
| 14 #include "ui/aura/client/screen_position_client.h" | 13 #include "ui/aura/client/screen_position_client.h" |
| 15 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
| 16 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 17 #include "ui/base/clipboard/clipboard.h" | 16 #include "ui/base/clipboard/clipboard.h" |
| 18 #include "ui/base/range/range.h" | 17 #include "ui/base/range/range.h" |
| 19 #include "ui/base/ui_base_switches.h" | 18 #include "ui/base/ui_base_switches_util.h" |
| 20 | 19 |
| 21 namespace content { | 20 namespace content { |
| 22 | 21 |
| 23 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
| 24 // TouchEditableImplAura, public: | 23 // TouchEditableImplAura, public: |
| 25 | 24 |
| 26 TouchEditableImplAura::~TouchEditableImplAura() { | 25 TouchEditableImplAura::~TouchEditableImplAura() { |
| 27 Cleanup(); | 26 Cleanup(); |
| 28 } | 27 } |
| 29 | 28 |
| 30 // static | 29 // static |
| 31 TouchEditableImplAura* TouchEditableImplAura::Create() { | 30 TouchEditableImplAura* TouchEditableImplAura::Create() { |
| 32 #if defined(OS_CHROMEOS) | 31 if (switches::IsTouchEditingEnabled()) |
| 33 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 34 switches::kEnableTouchEditing)) | |
| 35 return new TouchEditableImplAura(); | 32 return new TouchEditableImplAura(); |
| 36 #endif | |
| 37 return NULL; | 33 return NULL; |
| 38 } | 34 } |
| 39 | 35 |
| 40 void TouchEditableImplAura::AttachToView(RenderWidgetHostViewAura* view) { | 36 void TouchEditableImplAura::AttachToView(RenderWidgetHostViewAura* view) { |
| 41 if (rwhva_ == view) | 37 if (rwhva_ == view) |
| 42 return; | 38 return; |
| 43 | 39 |
| 44 Cleanup(); | 40 Cleanup(); |
| 45 if (!view) | 41 if (!view) |
| 46 return; | 42 return; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 301 |
| 306 void TouchEditableImplAura::Cleanup() { | 302 void TouchEditableImplAura::Cleanup() { |
| 307 if (rwhva_) { | 303 if (rwhva_) { |
| 308 rwhva_->set_touch_editing_client(NULL); | 304 rwhva_->set_touch_editing_client(NULL); |
| 309 rwhva_ = NULL; | 305 rwhva_ = NULL; |
| 310 } | 306 } |
| 311 touch_selection_controller_.reset(); | 307 touch_selection_controller_.reset(); |
| 312 } | 308 } |
| 313 | 309 |
| 314 } // namespace content | 310 } // namespace content |
| OLD | NEW |