| 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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 selected_keyword_view_->SetKeyword(keyword); | 702 selected_keyword_view_->SetKeyword(keyword); |
| 703 const TemplateURL* template_url = | 703 const TemplateURL* template_url = |
| 704 TemplateURLServiceFactory::GetForProfile(profile_)-> | 704 TemplateURLServiceFactory::GetForProfile(profile_)-> |
| 705 GetTemplateURLForKeyword(keyword); | 705 GetTemplateURLForKeyword(keyword); |
| 706 if (template_url && template_url->IsExtensionKeyword()) { | 706 if (template_url && template_url->IsExtensionKeyword()) { |
| 707 gfx::Image image = extensions::OmniboxAPI::Get(profile_)-> | 707 gfx::Image image = extensions::OmniboxAPI::Get(profile_)-> |
| 708 GetOmniboxIcon(template_url->GetExtensionId()); | 708 GetOmniboxIcon(template_url->GetExtensionId()); |
| 709 selected_keyword_view_->SetImage(image.AsImageSkia()); | 709 selected_keyword_view_->SetImage(image.AsImageSkia()); |
| 710 selected_keyword_view_->set_is_extension_icon(true); | 710 selected_keyword_view_->set_is_extension_icon(true); |
| 711 } else { | 711 } else { |
| 712 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
| 713 selected_keyword_view_->SetImage( | 712 selected_keyword_view_->SetImage( |
| 714 *rb.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); | 713 *(GetThemeProvider()->GetImageSkiaNamed(IDR_OMNIBOX_SEARCH))); |
| 715 selected_keyword_view_->set_is_extension_icon(false); | 714 selected_keyword_view_->set_is_extension_icon(false); |
| 716 } | 715 } |
| 717 } | 716 } |
| 718 } else if (model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { | 717 } else if (model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { |
| 719 ev_bubble_view_->SetLabel(model_->GetEVCertName()); | 718 ev_bubble_view_->SetLabel(model_->GetEVCertName()); |
| 720 left_decorations.AddDecoration( | 719 left_decorations.AddDecoration( |
| 721 kBubbleLocationY, 0, false, kMaxBubbleFraction, | 720 kBubbleLocationY, 0, false, kMaxBubbleFraction, |
| 722 kBubbleHorizontalPadding, GetItemPadding(), 0, ev_bubble_view_); | 721 kBubbleHorizontalPadding, GetItemPadding(), 0, ev_bubble_view_); |
| 723 } else { | 722 } else { |
| 724 left_decorations.AddDecoration( | 723 left_decorations.AddDecoration( |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 } else { | 1002 } else { |
| 1004 // The navigation controller will delete the fetcher. | 1003 // The navigation controller will delete the fetcher. |
| 1005 } | 1004 } |
| 1006 } | 1005 } |
| 1007 } | 1006 } |
| 1008 } | 1007 } |
| 1009 } | 1008 } |
| 1010 | 1009 |
| 1011 void LocationBarView::OnChanged() { | 1010 void LocationBarView::OnChanged() { |
| 1012 location_icon_view_->SetImage( | 1011 location_icon_view_->SetImage( |
| 1013 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 1012 GetThemeProvider()->GetImageSkiaNamed(location_entry_->GetIcon())); |
| 1014 location_entry_->GetIcon())); | |
| 1015 location_icon_view_->ShowTooltip(!GetLocationEntry()->IsEditingOrEmpty()); | 1013 location_icon_view_->ShowTooltip(!GetLocationEntry()->IsEditingOrEmpty()); |
| 1016 | 1014 |
| 1017 Layout(); | 1015 Layout(); |
| 1018 SchedulePaint(); | 1016 SchedulePaint(); |
| 1019 } | 1017 } |
| 1020 | 1018 |
| 1021 void LocationBarView::OnSelectionBoundsChanged() { | 1019 void LocationBarView::OnSelectionBoundsChanged() { |
| 1022 } | 1020 } |
| 1023 | 1021 |
| 1024 void LocationBarView::OnInputInProgress(bool in_progress) { | 1022 void LocationBarView::OnInputInProgress(bool in_progress) { |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1464 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
| 1467 int total_height = | 1465 int total_height = |
| 1468 use_preferred_size ? GetPreferredSize().height() : height(); | 1466 use_preferred_size ? GetPreferredSize().height() : height(); |
| 1469 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); | 1467 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); |
| 1470 } | 1468 } |
| 1471 | 1469 |
| 1472 bool LocationBarView::HasValidSuggestText() const { | 1470 bool LocationBarView::HasValidSuggestText() const { |
| 1473 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1471 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
| 1474 !suggested_text_view_->text().empty(); | 1472 !suggested_text_view_->text().empty(); |
| 1475 } | 1473 } |
| OLD | NEW |