| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 return star_view_->visible(); | 915 return star_view_->visible(); |
| 915 } | 916 } |
| 916 | 917 |
| 917 bool LocationBarView::TestContentSettingImagePressed(size_t index) { | 918 bool LocationBarView::TestContentSettingImagePressed(size_t index) { |
| 918 if (index >= content_setting_views_.size()) | 919 if (index >= content_setting_views_.size()) |
| 919 return false; | 920 return false; |
| 920 | 921 |
| 921 // This up-cast is necessary since the descendant class moved OnKeyPressed | 922 // This up-cast is necessary since the descendant class moved OnKeyPressed |
| 922 // to the protected section. | 923 // to the protected section. |
| 923 views::View* image_view = content_setting_views_[index]; | 924 views::View* image_view = content_setting_views_[index]; |
| 925 image_view->SetSize(gfx::Size(24, 24)); |
| 924 image_view->OnKeyReleased( | 926 image_view->OnKeyReleased( |
| 925 ui::KeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE)); | 927 ui::KeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE)); |
| 926 return true; | 928 return true; |
| 927 } | 929 } |
| 928 | 930 |
| 929 //////////////////////////////////////////////////////////////////////////////// | 931 //////////////////////////////////////////////////////////////////////////////// |
| 930 // LocationBarView, private views::View implementation: | 932 // LocationBarView, private views::View implementation: |
| 931 | 933 |
| 932 const char* LocationBarView::GetClassName() const { | 934 const char* LocationBarView::GetClassName() const { |
| 933 return kViewClassName; | 935 return kViewClassName; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 // LocationBarView, private TemplateURLServiceObserver implementation: | 1042 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1041 | 1043 |
| 1042 void LocationBarView::OnTemplateURLServiceChanged() { | 1044 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1043 template_url_service_->RemoveObserver(this); | 1045 template_url_service_->RemoveObserver(this); |
| 1044 template_url_service_ = nullptr; | 1046 template_url_service_ = nullptr; |
| 1045 // If the browser is no longer active, let's not show the info bubble, as this | 1047 // If the browser is no longer active, let's not show the info bubble, as this |
| 1046 // would make the browser the active window again. | 1048 // would make the browser the active window again. |
| 1047 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1049 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1048 ShowFirstRunBubble(); | 1050 ShowFirstRunBubble(); |
| 1049 } | 1051 } |
| OLD | NEW |