Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 10968049: Disable right button drag in omnibox (Closed) Base URL: http://git.chromium.org/chromium/src.git@new
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Do not change or select text by right button drag.
109 if (event.IsOnlyRightMouseButton())
110 return true;
108 bool result = views::Textfield::OnMouseDragged(event); 111 bool result = views::Textfield::OnMouseDragged(event);
109 omnibox_view_->HandleMouseDragEvent(event); 112 omnibox_view_->HandleMouseDragEvent(event);
110 return result; 113 return result;
111 } 114 }
112 115
113 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE { 116 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE {
114 views::Textfield::OnMouseReleased(event); 117 views::Textfield::OnMouseReleased(event);
sky 2012/09/24 14:03:02 Do things get confused without forwarding the rele
simonhong_ 2012/09/24 16:32:21 You mean context menu also need to disable with dr
sky 2012/09/24 16:48:09 No, I just wasn't sure if omnibox_view_ might get
115 omnibox_view_->HandleMouseReleaseEvent(event); 118 omnibox_view_->HandleMouseReleaseEvent(event);
116 } 119 }
117 120
118 protected: 121 protected:
119 // views::View implementation. 122 // views::View implementation.
120 virtual void PaintChildren(gfx::Canvas* canvas) { 123 virtual void PaintChildren(gfx::Canvas* canvas) {
121 views::Textfield::PaintChildren(canvas); 124 views::Textfield::PaintChildren(canvas);
122 MaybeDrawPlaceholderText(canvas); 125 MaybeDrawPlaceholderText(canvas);
123 } 126 }
124 127
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 929
927 string16 OmniboxViewViews::GetSelectedText() const { 930 string16 OmniboxViewViews::GetSelectedText() const {
928 // TODO(oshima): Support instant, IME. 931 // TODO(oshima): Support instant, IME.
929 return textfield_->GetSelectedText(); 932 return textfield_->GetSelectedText();
930 } 933 }
931 934
932 void OmniboxViewViews::CopyURL() { 935 void OmniboxViewViews::CopyURL() {
933 const string16& text = toolbar_model()->GetText(false); 936 const string16& text = toolbar_model()->GetText(false);
934 DoCopy(text, true, toolbar_model()->GetURL(), text); 937 DoCopy(text, true, toolbar_model()->GetURL(), text);
935 } 938 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698