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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 if (!suggested_text_view_) { | 468 if (!suggested_text_view_) { |
469 suggested_text_view_ = new SuggestedTextView(location_entry_->model()); | 469 suggested_text_view_ = new SuggestedTextView(location_entry_->model()); |
470 suggested_text_view_->SetText(text); | 470 suggested_text_view_->SetText(text); |
471 if (views::Widget::IsPureViews()) | 471 if (views::Widget::IsPureViews()) |
472 NOTIMPLEMENTED(); | 472 NOTIMPLEMENTED(); |
473 #if !defined(USE_AURA) | 473 #if !defined(USE_AURA) |
474 else | 474 else |
475 suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont()); | 475 suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont()); |
476 #endif | 476 #endif |
477 AddChildView(suggested_text_view_); | 477 AddChildView(suggested_text_view_); |
478 } else if (suggested_text_view_->GetText() != text) { | 478 } else if (suggested_text_view_->text() != text) { |
479 suggested_text_view_->SetText(text); | 479 suggested_text_view_->SetText(text); |
480 } | 480 } |
481 if (animate_to_complete && !location_entry_->IsImeComposing()) | 481 if (animate_to_complete && !location_entry_->IsImeComposing()) |
482 suggested_text_view_->StartAnimation(); | 482 suggested_text_view_->StartAnimation(); |
483 } else if (suggested_text_view_) { | 483 } else if (suggested_text_view_) { |
484 delete suggested_text_view_; | 484 delete suggested_text_view_; |
485 suggested_text_view_ = NULL; | 485 suggested_text_view_ = NULL; |
486 } else { | 486 } else { |
487 return; | 487 return; |
488 } | 488 } |
489 | 489 |
490 Layout(); | 490 Layout(); |
491 SchedulePaint(); | 491 SchedulePaint(); |
492 } | 492 } |
493 | 493 |
494 string16 LocationBarView::GetInstantSuggestion() const { | 494 string16 LocationBarView::GetInstantSuggestion() const { |
495 return HasValidSuggestText() ? suggested_text_view_->GetText() : string16(); | 495 return HasValidSuggestText() ? suggested_text_view_->text() : string16(); |
496 } | 496 } |
497 #endif | 497 #endif |
498 | 498 |
499 void LocationBarView::SetLocationEntryFocusable(bool focusable) { | 499 void LocationBarView::SetLocationEntryFocusable(bool focusable) { |
500 if (views::Widget::IsPureViews()) | 500 if (views::Widget::IsPureViews()) |
501 AsViews(location_entry_.get())->SetLocationEntryFocusable(focusable); | 501 AsViews(location_entry_.get())->SetLocationEntryFocusable(focusable); |
502 else | 502 else |
503 set_focusable(focusable); | 503 set_focusable(focusable); |
504 } | 504 } |
505 | 505 |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 1293 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
1294 std::string* name = content::Details<std::string>(details).ptr(); | 1294 std::string* name = content::Details<std::string>(details).ptr(); |
1295 if (*name == prefs::kEditBookmarksEnabled) | 1295 if (*name == prefs::kEditBookmarksEnabled) |
1296 Update(NULL); | 1296 Update(NULL); |
1297 } | 1297 } |
1298 } | 1298 } |
1299 | 1299 |
1300 #if defined(OS_WIN) || defined(USE_AURA) | 1300 #if defined(OS_WIN) || defined(USE_AURA) |
1301 bool LocationBarView::HasValidSuggestText() const { | 1301 bool LocationBarView::HasValidSuggestText() const { |
1302 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1302 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
1303 !suggested_text_view_->GetText().empty(); | 1303 !suggested_text_view_->text().empty(); |
1304 } | 1304 } |
1305 | 1305 |
1306 #if !defined(USE_AURA) | 1306 #if !defined(USE_AURA) |
1307 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1307 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
1308 CHECK(!views::Widget::IsPureViews()); | 1308 CHECK(!views::Widget::IsPureViews()); |
1309 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1309 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
1310 } | 1310 } |
1311 #endif | 1311 #endif |
1312 #endif | 1312 #endif |
OLD | NEW |