| 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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 return; | 672 return; |
| 673 | 673 |
| 674 security_state::SecurityLevel security_level = | 674 security_state::SecurityLevel security_level = |
| 675 GetToolbarModel()->GetSecurityLevel(false); | 675 GetToolbarModel()->GetSecurityLevel(false); |
| 676 SkColor icon_color = (security_level == security_state::NONE || | 676 SkColor icon_color = (security_level == security_state::NONE || |
| 677 security_level == security_state::HTTP_SHOW_WARNING) | 677 security_level == security_state::HTTP_SHOW_WARNING) |
| 678 ? color_utils::DeriveDefaultIconColor(GetColor(TEXT)) | 678 ? color_utils::DeriveDefaultIconColor(GetColor(TEXT)) |
| 679 : GetSecureTextColor(security_level); | 679 : GetSecureTextColor(security_level); |
| 680 location_icon_view_->SetImage(gfx::CreateVectorIcon( | 680 location_icon_view_->SetImage(gfx::CreateVectorIcon( |
| 681 omnibox_view_->GetVectorIcon(), kIconWidth, icon_color)); | 681 omnibox_view_->GetVectorIcon(), kIconWidth, icon_color)); |
| 682 location_icon_view_->SetEnabled(!omnibox_view_->IsEditingOrEmpty()); |
| 682 } | 683 } |
| 683 | 684 |
| 684 bool LocationBarView::RefreshContentSettingViews() { | 685 bool LocationBarView::RefreshContentSettingViews() { |
| 685 bool visibility_changed = false; | 686 bool visibility_changed = false; |
| 686 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); | 687 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); |
| 687 i != content_setting_views_.end(); ++i) { | 688 i != content_setting_views_.end(); ++i) { |
| 688 const bool was_visible = (*i)->visible(); | 689 const bool was_visible = (*i)->visible(); |
| 689 (*i)->Update(GetToolbarModel()->input_in_progress() ? nullptr | 690 (*i)->Update(GetToolbarModel()->input_in_progress() ? nullptr |
| 690 : GetWebContents()); | 691 : GetWebContents()); |
| 691 if (was_visible != (*i)->visible()) | 692 if (was_visible != (*i)->visible()) |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 | 913 |
| 913 bool LocationBarView::GetBookmarkStarVisibility() { | 914 bool LocationBarView::GetBookmarkStarVisibility() { |
| 914 DCHECK(star_view_); | 915 DCHECK(star_view_); |
| 915 return star_view_->visible(); | 916 return star_view_->visible(); |
| 916 } | 917 } |
| 917 | 918 |
| 918 bool LocationBarView::TestContentSettingImagePressed(size_t index) { | 919 bool LocationBarView::TestContentSettingImagePressed(size_t index) { |
| 919 if (index >= content_setting_views_.size()) | 920 if (index >= content_setting_views_.size()) |
| 920 return false; | 921 return false; |
| 921 | 922 |
| 922 // This up-cast is necessary since the descendant class moved OnKeyPressed | |
| 923 // to the protected section. | |
| 924 views::View* image_view = content_setting_views_[index]; | 923 views::View* image_view = content_setting_views_[index]; |
| 924 image_view->SetSize(gfx::Size(24, 24)); |
| 925 image_view->OnKeyPressed( |
| 926 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE)); |
| 925 image_view->OnKeyReleased( | 927 image_view->OnKeyReleased( |
| 926 ui::KeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE)); | 928 ui::KeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE)); |
| 927 return true; | 929 return true; |
| 928 } | 930 } |
| 929 | 931 |
| 930 //////////////////////////////////////////////////////////////////////////////// | 932 //////////////////////////////////////////////////////////////////////////////// |
| 931 // LocationBarView, private views::View implementation: | 933 // LocationBarView, private views::View implementation: |
| 932 | 934 |
| 933 const char* LocationBarView::GetClassName() const { | 935 const char* LocationBarView::GetClassName() const { |
| 934 return kViewClassName; | 936 return kViewClassName; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 // LocationBarView, private TemplateURLServiceObserver implementation: | 1043 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1042 | 1044 |
| 1043 void LocationBarView::OnTemplateURLServiceChanged() { | 1045 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1044 template_url_service_->RemoveObserver(this); | 1046 template_url_service_->RemoveObserver(this); |
| 1045 template_url_service_ = nullptr; | 1047 template_url_service_ = nullptr; |
| 1046 // If the browser is no longer active, let's not show the info bubble, as this | 1048 // If the browser is no longer active, let's not show the info bubble, as this |
| 1047 // would make the browser the active window again. | 1049 // would make the browser the active window again. |
| 1048 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1050 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1049 ShowFirstRunBubble(); | 1051 ShowFirstRunBubble(); |
| 1050 } | 1052 } |
| OLD | NEW |