Chromium Code Reviews| 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/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 98 |
| 99 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { | 99 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { |
| 100 // Pass through the views::Textfield's return value; we don't need to | 100 // Pass through the views::Textfield's return value; we don't need to |
| 101 // override its behavior. | 101 // override its behavior. |
| 102 bool result = views::Textfield::OnMousePressed(event); | 102 bool result = views::Textfield::OnMousePressed(event); |
| 103 omnibox_view_->HandleMousePressEvent(event); | 103 omnibox_view_->HandleMousePressEvent(event); |
| 104 return result; | 104 return result; |
| 105 } | 105 } |
| 106 | 106 |
| 107 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE { | 107 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE { |
| 108 bool result = views::Textfield::OnMouseDragged(event); | 108 bool result = true; |
| 109 // Do not handle anythin with right button drag. | |
| 110 if (!event.IsOnlyRightMouseButton()) | |
| 111 result = views::Textfield::OnMouseDragged(event); | |
|
sky
2012/09/24 20:54:08
I think we should do this directly in TextField, a
| |
| 112 | |
| 109 omnibox_view_->HandleMouseDragEvent(event); | 113 omnibox_view_->HandleMouseDragEvent(event); |
| 110 return result; | 114 return result; |
| 111 } | 115 } |
| 112 | 116 |
| 113 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE { | 117 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE { |
| 114 views::Textfield::OnMouseReleased(event); | 118 views::Textfield::OnMouseReleased(event); |
| 115 omnibox_view_->HandleMouseReleaseEvent(event); | 119 omnibox_view_->HandleMouseReleaseEvent(event); |
| 116 } | 120 } |
| 117 | 121 |
| 118 protected: | 122 protected: |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 926 | 930 |
| 927 string16 OmniboxViewViews::GetSelectedText() const { | 931 string16 OmniboxViewViews::GetSelectedText() const { |
| 928 // TODO(oshima): Support instant, IME. | 932 // TODO(oshima): Support instant, IME. |
| 929 return textfield_->GetSelectedText(); | 933 return textfield_->GetSelectedText(); |
| 930 } | 934 } |
| 931 | 935 |
| 932 void OmniboxViewViews::CopyURL() { | 936 void OmniboxViewViews::CopyURL() { |
| 933 const string16& text = toolbar_model()->GetText(false); | 937 const string16& text = toolbar_model()->GetText(false); |
| 934 DoCopy(text, true, toolbar_model()->GetURL(), text); | 938 DoCopy(text, true, toolbar_model()->GetURL(), text); |
| 935 } | 939 } |
| OLD | NEW |