| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 return base::string16(); | 84 return base::string16(); |
| 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::GetOriginChipV2Condition() == |
| 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 controller()->HideOriginChip(); | 96 controller()->HideOriginChip(); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void OmniboxView::OnDidKillFocus() { | 100 void OmniboxView::OnDidKillFocus() { |
| 101 if (chrome::ShouldDisplayOriginChipV2() && | 101 if (chrome::ShouldDisplayOriginChipV2() && |
| 102 !model()->user_input_in_progress()) { | 102 !model()->user_input_in_progress()) { |
| 103 controller()->ShowOriginChip(); | 103 controller()->ShowOriginChip(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // |profile| can be NULL in tests. | 222 // |profile| can be NULL in tests. |
| 223 if (profile) | 223 if (profile) |
| 224 model_.reset(new OmniboxEditModel(this, controller, profile)); | 224 model_.reset(new OmniboxEditModel(this, controller, profile)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void OmniboxView::TextChanged() { | 227 void OmniboxView::TextChanged() { |
| 228 EmphasizeURLComponents(); | 228 EmphasizeURLComponents(); |
| 229 if (model_.get()) | 229 if (model_.get()) |
| 230 model_->OnChanged(); | 230 model_->OnChanged(); |
| 231 } | 231 } |
| OLD | NEW |