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/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 origin.set_x(GetMirroredXInView(origin.x())); | 425 origin.set_x(GetMirroredXInView(origin.x())); |
| 426 views::View::ConvertPointToScreen(this, &origin); | 426 views::View::ConvertPointToScreen(this, &origin); |
| 427 return origin; | 427 return origin; |
| 428 } | 428 } |
| 429 | 429 |
| 430 void LocationBarView::SetImeInlineAutocompletion(const base::string16& text) { | 430 void LocationBarView::SetImeInlineAutocompletion(const base::string16& text) { |
| 431 ime_inline_autocomplete_view_->SetText(text); | 431 ime_inline_autocomplete_view_->SetText(text); |
| 432 ime_inline_autocomplete_view_->SetVisible(!text.empty()); | 432 ime_inline_autocomplete_view_->SetVisible(!text.empty()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void LocationBarView::SetGrayTextAutocompletion(const base::string16& text) { | |
| 436 if (suggested_text_view_->text() != text) { | |
| 437 suggested_text_view_->SetText(text); | |
| 438 suggested_text_view_->SetVisible(!text.empty()); | |
| 439 Layout(); | |
| 440 SchedulePaint(); | |
| 441 } | |
| 442 } | |
| 443 | |
| 444 base::string16 LocationBarView::GetGrayTextAutocompletion() const { | |
| 445 return HasValidSuggestText() ? | |
| 446 suggested_text_view_->text() : base::string16(); | |
|
Peter Kasting
2016/11/21 21:11:43
suggested_text_view_ and HasValidSuggestText() sho
Marc Treib
2016/11/22 10:35:30
Done.
| |
| 447 } | |
| 448 | |
| 449 void LocationBarView::SetShowFocusRect(bool show) { | 435 void LocationBarView::SetShowFocusRect(bool show) { |
| 450 show_focus_rect_ = show; | 436 show_focus_rect_ = show; |
| 451 SchedulePaint(); | 437 SchedulePaint(); |
| 452 } | 438 } |
| 453 | 439 |
| 454 void LocationBarView::SelectAll() { | 440 void LocationBarView::SelectAll() { |
| 455 omnibox_view_->SelectAll(true); | 441 omnibox_view_->SelectAll(true); |
| 456 } | 442 } |
| 457 | 443 |
| 458 gfx::Point LocationBarView::GetLocationBarAnchorPoint() const { | 444 gfx::Point LocationBarView::GetLocationBarAnchorPoint() const { |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1348 // LocationBarView, private TemplateURLServiceObserver implementation: | 1334 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1349 | 1335 |
| 1350 void LocationBarView::OnTemplateURLServiceChanged() { | 1336 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1351 template_url_service_->RemoveObserver(this); | 1337 template_url_service_->RemoveObserver(this); |
| 1352 template_url_service_ = nullptr; | 1338 template_url_service_ = nullptr; |
| 1353 // If the browser is no longer active, let's not show the info bubble, as this | 1339 // If the browser is no longer active, let's not show the info bubble, as this |
| 1354 // would make the browser the active window again. | 1340 // would make the browser the active window again. |
| 1355 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1341 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1356 ShowFirstRunBubble(); | 1342 ShowFirstRunBubble(); |
| 1357 } | 1343 } |
| OLD | NEW |