Chromium Code Reviews| 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" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/command_updater.h" | 15 #include "chrome/browser/command_updater.h" |
| 16 #include "chrome/browser/defaults.h" | 16 #include "chrome/browser/defaults.h" |
| 17 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 17 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
| 18 #include "chrome/browser/extensions/extension_action.h" | 18 #include "chrome/browser/extensions/extension_action.h" |
| 19 #include "chrome/browser/extensions/extension_action_manager.h" | 19 #include "chrome/browser/extensions/extension_action_manager.h" |
| 20 #include "chrome/browser/extensions/extension_util.h" | 20 #include "chrome/browser/extensions/extension_util.h" |
| 21 #include "chrome/browser/extensions/location_bar_controller.h" | 21 #include "chrome/browser/extensions/location_bar_controller.h" |
| 22 #include "chrome/browser/extensions/tab_helper.h" | 22 #include "chrome/browser/extensions/tab_helper.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/search_engines/template_url_service_factory.h" | 24 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 25 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | |
|
Peter Kasting
2016/08/18 06:24:37
Nit: I think none of these new #includes are neces
Kevin Bailey
2016/08/18 16:09:36
Done.
| |
| 25 #include "chrome/browser/themes/theme_properties.h" | 26 #include "chrome/browser/themes/theme_properties.h" |
| 26 #include "chrome/browser/translate/chrome_translate_client.h" | 27 #include "chrome/browser/translate/chrome_translate_client.h" |
| 27 #include "chrome/browser/translate/translate_service.h" | 28 #include "chrome/browser/translate/translate_service.h" |
| 28 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" | 29 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" |
| 29 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 30 #include "chrome/browser/ui/browser_finder.h" | 31 #include "chrome/browser/ui/browser_finder.h" |
| 31 #include "chrome/browser/ui/browser_window.h" | 32 #include "chrome/browser/ui/browser_window.h" |
| 32 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 33 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 33 #include "chrome/browser/ui/layout_constants.h" | 34 #include "chrome/browser/ui/layout_constants.h" |
| 34 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 35 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 56 #include "components/favicon/content/content_favicon_driver.h" | 57 #include "components/favicon/content/content_favicon_driver.h" |
| 57 #include "components/omnibox/browser/omnibox_popup_model.h" | 58 #include "components/omnibox/browser/omnibox_popup_model.h" |
| 58 #include "components/omnibox/browser/omnibox_popup_view.h" | 59 #include "components/omnibox/browser/omnibox_popup_view.h" |
| 59 #include "components/prefs/pref_service.h" | 60 #include "components/prefs/pref_service.h" |
| 60 #include "components/search_engines/template_url.h" | 61 #include "components/search_engines/template_url.h" |
| 61 #include "components/search_engines/template_url_service.h" | 62 #include "components/search_engines/template_url_service.h" |
| 62 #include "components/toolbar/toolbar_model.h" | 63 #include "components/toolbar/toolbar_model.h" |
| 63 #include "components/translate/core/browser/language_state.h" | 64 #include "components/translate/core/browser/language_state.h" |
| 64 #include "components/zoom/zoom_controller.h" | 65 #include "components/zoom/zoom_controller.h" |
| 65 #include "components/zoom/zoom_event_manager.h" | 66 #include "components/zoom/zoom_event_manager.h" |
| 67 #include "content/public/browser/navigation_entry.h" | |
| 66 #include "content/public/browser/render_widget_host_view.h" | 68 #include "content/public/browser/render_widget_host_view.h" |
| 67 #include "content/public/browser/web_contents.h" | 69 #include "content/public/browser/web_contents.h" |
| 70 #include "content/public/common/ssl_status.h" | |
| 68 #include "extensions/browser/extension_registry.h" | 71 #include "extensions/browser/extension_registry.h" |
| 69 #include "extensions/common/feature_switch.h" | 72 #include "extensions/common/feature_switch.h" |
| 70 #include "grit/components_scaled_resources.h" | 73 #include "grit/components_scaled_resources.h" |
| 71 #include "grit/theme_resources.h" | 74 #include "grit/theme_resources.h" |
| 72 #include "ui/accessibility/ax_view_state.h" | 75 #include "ui/accessibility/ax_view_state.h" |
| 73 #include "ui/base/dragdrop/drag_drop_types.h" | 76 #include "ui/base/dragdrop/drag_drop_types.h" |
| 74 #include "ui/base/material_design/material_design_controller.h" | 77 #include "ui/base/material_design/material_design_controller.h" |
| 75 #include "ui/base/resource/resource_bundle.h" | 78 #include "ui/base/resource/resource_bundle.h" |
| 76 #include "ui/base/theme_provider.h" | 79 #include "ui/base/theme_provider.h" |
| 77 #include "ui/compositor/paint_recorder.h" | 80 #include "ui/compositor/paint_recorder.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 keyword_hint_view_(nullptr), | 133 keyword_hint_view_(nullptr), |
| 131 zoom_view_(nullptr), | 134 zoom_view_(nullptr), |
| 132 open_pdf_in_reader_view_(nullptr), | 135 open_pdf_in_reader_view_(nullptr), |
| 133 manage_passwords_icon_view_(nullptr), | 136 manage_passwords_icon_view_(nullptr), |
| 134 save_credit_card_icon_view_(nullptr), | 137 save_credit_card_icon_view_(nullptr), |
| 135 translate_icon_view_(nullptr), | 138 translate_icon_view_(nullptr), |
| 136 star_view_(nullptr), | 139 star_view_(nullptr), |
| 137 size_animation_(this), | 140 size_animation_(this), |
| 138 is_popup_mode_(is_popup_mode), | 141 is_popup_mode_(is_popup_mode), |
| 139 show_focus_rect_(false), | 142 show_focus_rect_(false), |
| 143 showing_security_chip_(false), | |
| 140 template_url_service_(NULL), | 144 template_url_service_(NULL), |
| 141 web_contents_null_at_last_refresh_(true) { | 145 web_contents_null_at_last_refresh_(true) { |
| 142 edit_bookmarks_enabled_.Init( | 146 edit_bookmarks_enabled_.Init( |
| 143 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 147 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
| 144 base::Bind(&LocationBarView::UpdateWithoutTabRestore, | 148 base::Bind(&LocationBarView::UpdateWithoutTabRestore, |
| 145 base::Unretained(this))); | 149 base::Unretained(this))); |
| 146 | 150 |
| 147 zoom::ZoomEventManager::GetForBrowserContext(profile) | 151 zoom::ZoomEventManager::GetForBrowserContext(profile) |
| 148 ->AddZoomEventManagerObserver(this); | 152 ->AddZoomEventManagerObserver(this); |
| 149 } | 153 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 return native_theme->GetSystemColor( | 323 return native_theme->GetSystemColor( |
| 320 ui::NativeTheme::kColorId_TextfieldDefaultColor); | 324 ui::NativeTheme::kColorId_TextfieldDefaultColor); |
| 321 | 325 |
| 322 case SELECTED_TEXT: | 326 case SELECTED_TEXT: |
| 323 return native_theme->GetSystemColor( | 327 return native_theme->GetSystemColor( |
| 324 ui::NativeTheme::kColorId_TextfieldSelectionColor); | 328 ui::NativeTheme::kColorId_TextfieldSelectionColor); |
| 325 | 329 |
| 326 case DEEMPHASIZED_TEXT: | 330 case DEEMPHASIZED_TEXT: |
| 327 return color_utils::AlphaBlend(GetColor(TEXT), GetColor(BACKGROUND), 128); | 331 return color_utils::AlphaBlend(GetColor(TEXT), GetColor(BACKGROUND), 128); |
| 328 | 332 |
| 329 case EV_BUBBLE_TEXT_AND_BORDER: | 333 case SECURITY_CHIP_TEXT_AND_BORDER: |
| 330 return ui::MaterialDesignController::IsModeMaterial() | 334 return ui::MaterialDesignController::IsModeMaterial() |
| 331 ? GetSecureTextColor( | 335 ? GetSecureTextColor( |
| 332 security_state::SecurityStateModel::EV_SECURE) | 336 GetToolbarModel()->GetSecurityLevel(false)) |
| 333 : SkColorSetRGB(7, 149, 0); | 337 : SkColorSetRGB(7, 149, 0); |
| 334 } | 338 } |
| 335 NOTREACHED(); | 339 NOTREACHED(); |
| 336 return gfx::kPlaceholderColor; | 340 return gfx::kPlaceholderColor; |
| 337 } | 341 } |
| 338 | 342 |
| 339 SkColor LocationBarView::GetSecureTextColor( | 343 SkColor LocationBarView::GetSecureTextColor( |
| 340 security_state::SecurityStateModel::SecurityLevel security_level) const { | 344 security_state::SecurityStateModel::SecurityLevel security_level) const { |
| 341 if (security_level == | 345 if (security_level == |
| 342 security_state::SecurityStateModel::SECURITY_POLICY_WARNING) { | 346 security_state::SecurityStateModel::SECURITY_POLICY_WARNING) { |
| 343 return GetColor(DEEMPHASIZED_TEXT); | 347 return GetColor(DEEMPHASIZED_TEXT); |
| 344 } | 348 } |
| 345 | 349 |
| 346 SkColor text_color = GetColor(TEXT); | 350 SkColor text_color = GetColor(TEXT); |
| 347 if ((security_level == security_state::SecurityStateModel::EV_SECURE) || | 351 if ((security_level == security_state::SecurityStateModel::EV_SECURE) || |
| 348 (security_level == security_state::SecurityStateModel::SECURE) || | 352 (security_level == security_state::SecurityStateModel::SECURE) || |
| 349 (security_level == security_state::SecurityStateModel::SECURITY_ERROR)) { | 353 (security_level == security_state::SecurityStateModel::SECURITY_ERROR)) { |
| 350 if (ui::MaterialDesignController::IsModeMaterial()) { | 354 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 351 if (color_utils::IsDark(GetColor(BACKGROUND))) | 355 if (color_utils::IsDark(GetColor(BACKGROUND))) |
| 352 return text_color; | 356 return text_color; |
| 353 if (security_level == security_state::SecurityStateModel::SECURITY_ERROR) | 357 if (security_level == security_state::SecurityStateModel::SECURITY_ERROR) |
| 354 text_color = gfx::kGoogleRed700; | 358 text_color = gfx::kGoogleRed700; |
| 355 else | 359 else |
| 356 text_color = gfx::kGoogleGreen700; | 360 text_color = gfx::kGoogleGreen700; |
| 357 } else if (security_level == | 361 } else if (security_level == |
| 358 security_state::SecurityStateModel::SECURITY_ERROR) { | 362 security_state::SecurityStateModel::SECURITY_ERROR) { |
| 359 text_color = SkColorSetRGB(162, 0, 0); | 363 text_color = SkColorSetRGB(162, 0, 0); |
| 360 } else { | 364 } else { |
| 361 text_color = GetColor(EV_BUBBLE_TEXT_AND_BORDER); | 365 text_color = GetColor(SECURITY_CHIP_TEXT_AND_BORDER); |
| 362 } | 366 } |
| 363 } | 367 } |
| 364 return color_utils::GetReadableColor(text_color, GetColor(BACKGROUND)); | 368 return color_utils::GetReadableColor(text_color, GetColor(BACKGROUND)); |
| 365 } | 369 } |
| 366 | 370 |
| 367 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) { | 371 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) { |
| 368 DCHECK(zoom_view_); | 372 DCHECK(zoom_view_); |
| 369 if (RefreshZoomView()) { | 373 if (RefreshZoomView()) { |
| 370 Layout(); | 374 Layout(); |
| 371 SchedulePaint(); | 375 SchedulePaint(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 | 529 |
| 526 min_size.set_height(min_size.height() * size_animation_.GetCurrentValue()); | 530 min_size.set_height(min_size.height() * size_animation_.GetCurrentValue()); |
| 527 | 531 |
| 528 const int padding = GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING); | 532 const int padding = GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING); |
| 529 | 533 |
| 530 // Compute width of omnibox-leading content. | 534 // Compute width of omnibox-leading content. |
| 531 const int edge_thickness = GetHorizontalEdgeThickness(); | 535 const int edge_thickness = GetHorizontalEdgeThickness(); |
| 532 int leading_width = edge_thickness; | 536 int leading_width = edge_thickness; |
| 533 if (ShouldShowKeywordBubble()) { | 537 if (ShouldShowKeywordBubble()) { |
| 534 // The selected keyword view can collapse completely. | 538 // The selected keyword view can collapse completely. |
| 535 } else if (ShouldShowEVBubble()) { | 539 } else if (ShouldShowSecurityChip()) { |
| 536 leading_width += GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) + | 540 base::string16 label = GetSecurityText(); |
|
Peter Kasting
2016/08/18 06:24:37
Nit: |security_text| might be a better name.
Kevin Bailey
2016/08/18 16:09:36
If you prefer. I think once we cross line 540, it'
| |
| 537 location_icon_view_->GetMinimumSizeForLabelText( | 541 leading_width += |
| 538 GetToolbarModel()->GetEVCertName()) | 542 GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) + |
| 539 .width(); | 543 location_icon_view_->GetMinimumSizeForLabelText(label).width(); |
| 540 } else { | 544 } else { |
| 541 leading_width += padding + location_icon_view_->GetMinimumSize().width(); | 545 leading_width += padding + location_icon_view_->GetMinimumSize().width(); |
| 542 } | 546 } |
| 543 | 547 |
| 544 // Compute width of omnibox-trailing content. | 548 // Compute width of omnibox-trailing content. |
| 545 int trailing_width = edge_thickness; | 549 int trailing_width = edge_thickness; |
| 546 trailing_width += IncrementalMinimumWidth(star_view_) + | 550 trailing_width += IncrementalMinimumWidth(star_view_) + |
| 547 IncrementalMinimumWidth(translate_icon_view_) + | 551 IncrementalMinimumWidth(translate_icon_view_) + |
| 548 IncrementalMinimumWidth(open_pdf_in_reader_view_) + | 552 IncrementalMinimumWidth(open_pdf_in_reader_view_) + |
| 549 IncrementalMinimumWidth(save_credit_card_icon_view_) + | 553 IncrementalMinimumWidth(save_credit_card_icon_view_) + |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 605 (template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION)) { | 609 (template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION)) { |
| 606 gfx::Image image = extensions::OmniboxAPI::Get(profile())-> | 610 gfx::Image image = extensions::OmniboxAPI::Get(profile())-> |
| 607 GetOmniboxIcon(template_url->GetExtensionId()); | 611 GetOmniboxIcon(template_url->GetExtensionId()); |
| 608 selected_keyword_view_->SetImage(image.AsImageSkia()); | 612 selected_keyword_view_->SetImage(image.AsImageSkia()); |
| 609 selected_keyword_view_->set_is_extension_icon(true); | 613 selected_keyword_view_->set_is_extension_icon(true); |
| 610 } else { | 614 } else { |
| 611 selected_keyword_view_->ResetImage(); | 615 selected_keyword_view_->ResetImage(); |
| 612 selected_keyword_view_->set_is_extension_icon(false); | 616 selected_keyword_view_->set_is_extension_icon(false); |
| 613 } | 617 } |
| 614 } | 618 } |
| 615 } else if (ShouldShowEVBubble()) { | 619 } else if (ShouldShowSecurityChip()) { |
| 616 location_icon_view_->SetLabel(GetToolbarModel()->GetEVCertName()); | 620 location_icon_view_->SetLabel(GetSecurityText()); |
| 617 location_icon_view_->SetBackground(true); | 621 location_icon_view_->SetBackground(true); |
| 618 // The largest fraction of the omnibox that can be taken by the EV bubble. | 622 // The largest fraction of the omnibox that can be taken by the EV bubble. |
| 619 const double kMaxBubbleFraction = 0.5; | 623 const double kMaxBubbleFraction = 0.5; |
| 620 leading_decorations.AddDecoration( | 624 leading_decorations.AddDecoration( |
| 621 vertical_padding, location_height, false, kMaxBubbleFraction, | 625 vertical_padding, location_height, false, kMaxBubbleFraction, |
| 622 bubble_horizontal_padding, item_padding, location_icon_view_); | 626 bubble_horizontal_padding, item_padding, location_icon_view_); |
| 623 } else { | 627 } else { |
| 624 leading_decorations.AddDecoration(vertical_padding, location_height, | 628 leading_decorations.AddDecoration(vertical_padding, location_height, |
| 625 location_icon_view_); | 629 location_icon_view_); |
| 626 } | 630 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 } | 787 } |
| 784 } | 788 } |
| 785 | 789 |
| 786 void LocationBarView::Update(const WebContents* contents) { | 790 void LocationBarView::Update(const WebContents* contents) { |
| 787 RefreshContentSettingViews(); | 791 RefreshContentSettingViews(); |
| 788 RefreshZoomView(); | 792 RefreshZoomView(); |
| 789 RefreshPageActionViews(); | 793 RefreshPageActionViews(); |
| 790 RefreshTranslateIcon(); | 794 RefreshTranslateIcon(); |
| 791 RefreshSaveCreditCardIconView(); | 795 RefreshSaveCreditCardIconView(); |
| 792 RefreshManagePasswordsIconView(); | 796 RefreshManagePasswordsIconView(); |
| 793 content::WebContents* web_contents_for_sub_views = | 797 WebContents* web_contents_for_sub_views = |
| 794 GetToolbarModel()->input_in_progress() ? nullptr : GetWebContents(); | 798 GetToolbarModel()->input_in_progress() ? nullptr : GetWebContents(); |
| 795 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); | 799 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); |
| 796 | 800 |
| 797 if (star_view_) | 801 if (star_view_) |
| 798 UpdateBookmarkStarVisibility(); | 802 UpdateBookmarkStarVisibility(); |
| 799 | 803 |
| 800 if (contents) | 804 if (contents) |
| 801 omnibox_view_->OnTabChanged(contents); | 805 omnibox_view_->OnTabChanged(contents); |
| 802 else | 806 else |
| 803 omnibox_view_->Update(); | 807 omnibox_view_->Update(); |
| 804 | 808 |
| 809 if (ShouldShowSecurityChip() != showing_security_chip_) { | |
|
Peter Kasting
2016/08/18 06:24:37
If it is safe to rely on the animation calls being
Kevin Bailey
2016/08/18 16:09:36
Done, but it looks like this whole thing needs to
| |
| 810 if (ShouldShowSecurityChip()) { | |
| 811 showing_security_chip_ = true; | |
| 812 location_icon_view_->StartAnimation(); | |
| 813 } else { | |
| 814 showing_security_chip_ = false; | |
| 815 location_icon_view_->StopAnimation(); | |
| 816 } | |
| 817 } | |
| 818 | |
| 805 OnChanged(); // NOTE: Calls Layout(). | 819 OnChanged(); // NOTE: Calls Layout(). |
| 806 } | 820 } |
| 807 | 821 |
| 808 void LocationBarView::ResetTabState(WebContents* contents) { | 822 void LocationBarView::ResetTabState(WebContents* contents) { |
| 809 omnibox_view_->ResetTabState(contents); | 823 omnibox_view_->ResetTabState(contents); |
| 810 } | 824 } |
| 811 | 825 |
| 812 //////////////////////////////////////////////////////////////////////////////// | 826 //////////////////////////////////////////////////////////////////////////////// |
| 813 // LocationBarView, public OmniboxEditController implementation: | 827 // LocationBarView, public OmniboxEditController implementation: |
| 814 | 828 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1031 if (browser) | 1045 if (browser) |
| 1032 FirstRunBubble::ShowBubble(browser, location_icon_view_); | 1046 FirstRunBubble::ShowBubble(browser, location_icon_view_); |
| 1033 #endif | 1047 #endif |
| 1034 } | 1048 } |
| 1035 | 1049 |
| 1036 bool LocationBarView::HasValidSuggestText() const { | 1050 bool LocationBarView::HasValidSuggestText() const { |
| 1037 return suggested_text_view_->visible() && | 1051 return suggested_text_view_->visible() && |
| 1038 !suggested_text_view_->size().IsEmpty(); | 1052 !suggested_text_view_->size().IsEmpty(); |
| 1039 } | 1053 } |
| 1040 | 1054 |
| 1055 base::string16 LocationBarView::GetSecurityText() const { | |
| 1056 return ShouldShowEVBubble() ? GetToolbarModel()->GetEVCertName() | |
| 1057 : GetToolbarModel()->GetSecureVerboseText(); | |
| 1058 } | |
| 1059 | |
| 1041 bool LocationBarView::ShouldShowKeywordBubble() const { | 1060 bool LocationBarView::ShouldShowKeywordBubble() const { |
| 1042 return !omnibox_view_->model()->keyword().empty() && | 1061 return !omnibox_view_->model()->keyword().empty() && |
| 1043 !omnibox_view_->model()->is_keyword_hint(); | 1062 !omnibox_view_->model()->is_keyword_hint(); |
| 1044 } | 1063 } |
| 1045 | 1064 |
| 1046 bool LocationBarView::ShouldShowEVBubble() const { | 1065 bool LocationBarView::ShouldShowEVBubble() const { |
| 1047 return (GetToolbarModel()->GetSecurityLevel(false) == | 1066 return (GetToolbarModel()->GetSecurityLevel(false) == |
| 1048 security_state::SecurityStateModel::EV_SECURE); | 1067 security_state::SecurityStateModel::EV_SECURE); |
| 1049 } | 1068 } |
| 1050 | 1069 |
| 1070 bool LocationBarView::ShouldShowSecurityChip() const { | |
| 1071 if (ShouldShowKeywordBubble()) | |
| 1072 return false; | |
| 1073 security_state::SecurityStateModel::SecurityLevel level = | |
| 1074 GetToolbarModel()->GetSecurityLevel(false); | |
| 1075 if (level == security_state::SecurityStateModel::SecurityLevel::EV_SECURE || | |
|
Peter Kasting
2016/08/18 06:24:37
Nit: Could just
return level == ... ||
Kevin Bailey
2016/08/18 16:09:36
I can go as far as SecurityStateModel, so I don't
Peter Kasting
2016/08/20 01:16:43
Helps enough, probably. A type alias might get yo
Kevin Bailey
2016/08/22 15:58:56
Done.
| |
| 1076 level == security_state::SecurityStateModel::SecurityLevel::SECURE || | |
| 1077 level == | |
| 1078 security_state::SecurityStateModel::SecurityLevel::SECURITY_ERROR) { | |
|
Peter Kasting
2016/08/18 06:24:37
What about SECURITY_WARNING and SECURITY_POLICY_WA
Kevin Bailey
2016/08/18 16:09:36
I asked spqchan why it wasn't handled in her CL an
| |
| 1079 return true; | |
| 1080 } | |
| 1081 return false; | |
|
Peter Kasting
2016/08/18 06:24:37
Checking: Does the toolbar model return NONE any t
Kevin Bailey
2016/08/18 16:09:36
If the user starts editing after things have settl
Peter Kasting
2016/08/20 01:16:43
I don't understand this comment.
What does "prior
Kevin Bailey
2016/08/22 15:58:56
'omnibox_view_->IsEditingOrEmpty()' almost appears
Peter Kasting
2016/08/22 22:58:09
ToolbarModel::GetSecurityLevel()'s argument is cal
Kevin Bailey
2016/08/23 15:17:13
You should see my log. The omnibox_view_ goes from
Peter Kasting
2016/08/23 18:01:56
Since I don't know what you're looking at to deter
| |
| 1082 } | |
| 1083 | |
| 1051 //////////////////////////////////////////////////////////////////////////////// | 1084 //////////////////////////////////////////////////////////////////////////////// |
| 1052 // LocationBarView, private LocationBar implementation: | 1085 // LocationBarView, private LocationBar implementation: |
| 1053 | 1086 |
| 1054 void LocationBarView::ShowFirstRunBubble() { | 1087 void LocationBarView::ShowFirstRunBubble() { |
| 1055 // Wait until search engines have loaded to show the first run bubble. | 1088 // Wait until search engines have loaded to show the first run bubble. |
| 1056 TemplateURLService* url_service = | 1089 TemplateURLService* url_service = |
| 1057 TemplateURLServiceFactory::GetForProfile(profile()); | 1090 TemplateURLServiceFactory::GetForProfile(profile()); |
| 1058 if (!url_service->loaded()) { | 1091 if (!url_service->loaded()) { |
| 1059 template_url_service_ = url_service; | 1092 template_url_service_ = url_service; |
| 1060 template_url_service_->AddObserver(this); | 1093 template_url_service_->AddObserver(this); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1385 // LocationBarView, private TemplateURLServiceObserver implementation: | 1418 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1386 | 1419 |
| 1387 void LocationBarView::OnTemplateURLServiceChanged() { | 1420 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1388 template_url_service_->RemoveObserver(this); | 1421 template_url_service_->RemoveObserver(this); |
| 1389 template_url_service_ = nullptr; | 1422 template_url_service_ = nullptr; |
| 1390 // If the browser is no longer active, let's not show the info bubble, as this | 1423 // If the browser is no longer active, let's not show the info bubble, as this |
| 1391 // would make the browser the active window again. | 1424 // would make the browser the active window again. |
| 1392 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1425 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1393 ShowFirstRunBubble(); | 1426 ShowFirstRunBubble(); |
| 1394 } | 1427 } |
| OLD | NEW |