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 // This file defines helper functions shared by the various implementations | 5 // This file defines helper functions shared by the various implementations |
6 // of OmniboxView. | 6 // of OmniboxView. |
7 | 7 |
8 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 } | 85 } |
86 | 86 |
87 OmniboxView::~OmniboxView() { | 87 OmniboxView::~OmniboxView() { |
88 } | 88 } |
89 | 89 |
90 void OmniboxView::HandleOriginChipMouseRelease() { | 90 void OmniboxView::HandleOriginChipMouseRelease() { |
91 // HIDE_ON_MOUSE_RELEASE only hides if there isn't any current text in the | 91 // HIDE_ON_MOUSE_RELEASE only hides if there isn't any current text in the |
92 // Omnibox (e.g. search terms). | 92 // Omnibox (e.g. search terms). |
93 if ((chrome::GetOriginChipV2HideTrigger() == | 93 if ((chrome::GetOriginChipV2HideTrigger() == |
94 chrome::ORIGIN_CHIP_V2_HIDE_ON_MOUSE_RELEASE) && | 94 chrome::ORIGIN_CHIP_V2_HIDE_ON_MOUSE_RELEASE) && |
95 controller()->GetToolbarModel()->GetText().empty()) { | 95 controller()->GetToolbarModel()->GetText().empty() && |
96 !model()->focused_via_location_icon()) { | |
groby-ooo-7-16
2014/04/10 21:26:09
This feels very fragile - would it make more sense
macourteau
2014/04/28 19:19:24
Would the bubble already be showing by the time we
groby-ooo-7-16
2014/04/30 21:55:39
I think if you don't invoke HandleOriginChipMouseR
groby-ooo-7-16
2014/04/30 21:55:39
Keeping location icon behavior the same if there's
macourteau
2014/05/01 19:04:48
Yep, fixed.
| |
96 controller()->HideOriginChip(); | 97 controller()->HideOriginChip(); |
97 } | 98 } |
98 } | 99 } |
99 | 100 |
100 void OmniboxView::OnDidKillFocus() { | 101 void OmniboxView::OnDidKillFocus() { |
101 if (chrome::ShouldDisplayOriginChipV2() && | 102 if (chrome::ShouldDisplayOriginChipV2() && |
102 !model()->user_input_in_progress()) { | 103 !model()->user_input_in_progress()) { |
103 controller()->ShowOriginChip(); | 104 controller()->ShowOriginChip(); |
104 } | 105 } |
105 } | 106 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 // |profile| can be NULL in tests. | 223 // |profile| can be NULL in tests. |
223 if (profile) | 224 if (profile) |
224 model_.reset(new OmniboxEditModel(this, controller, profile)); | 225 model_.reset(new OmniboxEditModel(this, controller, profile)); |
225 } | 226 } |
226 | 227 |
227 void OmniboxView::TextChanged() { | 228 void OmniboxView::TextChanged() { |
228 EmphasizeURLComponents(); | 229 EmphasizeURLComponents(); |
229 if (model_.get()) | 230 if (model_.get()) |
230 model_->OnChanged(); | 231 model_->OnChanged(); |
231 } | 232 } |
OLD | NEW |