| 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 return; | 671 return; |
| 672 | 672 |
| 673 security_state::SecurityLevel security_level = | 673 security_state::SecurityLevel security_level = |
| 674 GetToolbarModel()->GetSecurityLevel(false); | 674 GetToolbarModel()->GetSecurityLevel(false); |
| 675 SkColor icon_color = (security_level == security_state::NONE || | 675 SkColor icon_color = (security_level == security_state::NONE || |
| 676 security_level == security_state::HTTP_SHOW_WARNING) | 676 security_level == security_state::HTTP_SHOW_WARNING) |
| 677 ? color_utils::DeriveDefaultIconColor(GetColor(TEXT)) | 677 ? color_utils::DeriveDefaultIconColor(GetColor(TEXT)) |
| 678 : GetSecureTextColor(security_level); | 678 : GetSecureTextColor(security_level); |
| 679 location_icon_view_->SetImage(gfx::CreateVectorIcon( | 679 location_icon_view_->SetImage(gfx::CreateVectorIcon( |
| 680 omnibox_view_->GetVectorIcon(), kIconWidth, icon_color)); | 680 omnibox_view_->GetVectorIcon(), kIconWidth, icon_color)); |
| 681 location_icon_view_->SetEnabled(!omnibox_view_->IsEditingOrEmpty()); |
| 681 } | 682 } |
| 682 | 683 |
| 683 bool LocationBarView::RefreshContentSettingViews() { | 684 bool LocationBarView::RefreshContentSettingViews() { |
| 684 bool visibility_changed = false; | 685 bool visibility_changed = false; |
| 685 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); | 686 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); |
| 686 i != content_setting_views_.end(); ++i) { | 687 i != content_setting_views_.end(); ++i) { |
| 687 const bool was_visible = (*i)->visible(); | 688 const bool was_visible = (*i)->visible(); |
| 688 (*i)->Update(GetToolbarModel()->input_in_progress() ? nullptr | 689 (*i)->Update(GetToolbarModel()->input_in_progress() ? nullptr |
| 689 : GetWebContents()); | 690 : GetWebContents()); |
| 690 if (was_visible != (*i)->visible()) | 691 if (was_visible != (*i)->visible()) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 return star_view_->visible(); | 906 return star_view_->visible(); |
| 906 } | 907 } |
| 907 | 908 |
| 908 bool LocationBarView::TestContentSettingImagePressed(size_t index) { | 909 bool LocationBarView::TestContentSettingImagePressed(size_t index) { |
| 909 if (index >= content_setting_views_.size()) | 910 if (index >= content_setting_views_.size()) |
| 910 return false; | 911 return false; |
| 911 | 912 |
| 912 // This up-cast is necessary since the descendant class moved OnKeyPressed | 913 // This up-cast is necessary since the descendant class moved OnKeyPressed |
| 913 // to the protected section. | 914 // to the protected section. |
| 914 views::View* image_view = content_setting_views_[index]; | 915 views::View* image_view = content_setting_views_[index]; |
| 916 image_view->SetSize(gfx::Size(24, 24)); |
| 915 image_view->OnKeyReleased( | 917 image_view->OnKeyReleased( |
| 916 ui::KeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE)); | 918 ui::KeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE)); |
| 917 return true; | 919 return true; |
| 918 } | 920 } |
| 919 | 921 |
| 920 //////////////////////////////////////////////////////////////////////////////// | 922 //////////////////////////////////////////////////////////////////////////////// |
| 921 // LocationBarView, private views::View implementation: | 923 // LocationBarView, private views::View implementation: |
| 922 | 924 |
| 923 const char* LocationBarView::GetClassName() const { | 925 const char* LocationBarView::GetClassName() const { |
| 924 return kViewClassName; | 926 return kViewClassName; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 // LocationBarView, private TemplateURLServiceObserver implementation: | 1033 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1032 | 1034 |
| 1033 void LocationBarView::OnTemplateURLServiceChanged() { | 1035 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1034 template_url_service_->RemoveObserver(this); | 1036 template_url_service_->RemoveObserver(this); |
| 1035 template_url_service_ = nullptr; | 1037 template_url_service_ = nullptr; |
| 1036 // If the browser is no longer active, let's not show the info bubble, as this | 1038 // If the browser is no longer active, let's not show the info bubble, as this |
| 1037 // would make the browser the active window again. | 1039 // would make the browser the active window again. |
| 1038 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1040 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1039 ShowFirstRunBubble(); | 1041 ShowFirstRunBubble(); |
| 1040 } | 1042 } |
| OLD | NEW |