Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 2456993002: [Mac] Fix security chip page load issue (Closed)
Patch Set: nit Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #import "base/mac/mac_util.h" 9 #import "base/mac/mac_util.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // Get the keyword to use for keyword-search and hinting. 483 // Get the keyword to use for keyword-search and hinting.
484 const base::string16 keyword = omnibox_view_->model()->keyword(); 484 const base::string16 keyword = omnibox_view_->model()->keyword();
485 base::string16 short_name; 485 base::string16 short_name;
486 bool is_extension_keyword = false; 486 bool is_extension_keyword = false;
487 if (!keyword.empty()) { 487 if (!keyword.empty()) {
488 short_name = TemplateURLServiceFactory::GetForProfile(profile())-> 488 short_name = TemplateURLServiceFactory::GetForProfile(profile())->
489 GetKeywordShortName(keyword, &is_extension_keyword); 489 GetKeywordShortName(keyword, &is_extension_keyword);
490 } 490 }
491 491
492 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); 492 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint();
493
494 // This is true for EV certificate since the certificate should be
495 // displayed, even if the width is narrow.
496 CGFloat available_width =
497 [cell availableWidthInFrame:[[cell controlView] frame]];
498 is_width_available_for_security_verbose_ =
499 available_width >= kMinURLWidth || ShouldShowEVBubble();
500
493 if (!keyword.empty() && !is_keyword_hint) { 501 if (!keyword.empty() && !is_keyword_hint) {
494 // Switch from location icon to keyword mode. 502 // Switch from location icon to keyword mode.
495 location_icon_decoration_->SetVisible(false); 503 location_icon_decoration_->SetVisible(false);
496 selected_keyword_decoration_->SetVisible(true); 504 selected_keyword_decoration_->SetVisible(true);
497 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); 505 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword);
498 // Note: the first time through this code path the 506 // Note: the first time through this code path the
499 // |selected_keyword_decoration_| has no image set because under Material 507 // |selected_keyword_decoration_| has no image set because under Material
500 // Design we need to set its color, which we cannot do until we know the 508 // Design we need to set its color, which we cannot do until we know the
501 // theme (by being installed in a browser window). 509 // theme (by being installed in a browser window).
502 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); 510 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword));
503 } else if (!keyword.empty() && is_keyword_hint) { 511 } else if (!keyword.empty() && is_keyword_hint) {
504 keyword_hint_decoration_->SetKeyword(short_name, is_extension_keyword); 512 keyword_hint_decoration_->SetKeyword(short_name, is_extension_keyword);
505 keyword_hint_decoration_->SetVisible(true); 513 keyword_hint_decoration_->SetVisible(true);
506 } else if (ShouldShowEVBubble()) { 514 } else if (ShouldShowEVBubble()) {
507 // Switch from location icon to show the EV bubble instead. 515 // Switch from location icon to show the EV bubble instead.
508 location_icon_decoration_->SetVisible(false); 516 location_icon_decoration_->SetVisible(false);
509 security_state_bubble_decoration_->SetVisible(true); 517 security_state_bubble_decoration_->SetVisible(true);
510 518
511 base::string16 label(GetToolbarModel()->GetEVCertName()); 519 base::string16 label(GetToolbarModel()->GetEVCertName());
512 security_state_bubble_decoration_->SetFullLabel( 520 security_state_bubble_decoration_->SetFullLabel(
513 base::SysUTF16ToNSString(label)); 521 base::SysUTF16ToNSString(label));
514
515 // This is true for EV certificate since the certificate should be
516 // displayed, even if the width is narrow.
517 is_width_available_for_security_verbose_ = true;
518 } else if (ShouldShowSecurityState()) { 522 } else if (ShouldShowSecurityState()) {
519 CGFloat available_width =
520 [cell availableWidthInFrame:[[cell controlView] frame]];
521 is_width_available_for_security_verbose_ = available_width >= kMinURLWidth;
522 bool is_security_state_visible = 523 bool is_security_state_visible =
523 is_width_available_for_security_verbose_ || 524 is_width_available_for_security_verbose_ ||
524 security_state_bubble_decoration_->AnimatingOut(); 525 security_state_bubble_decoration_->AnimatingOut();
525 location_icon_decoration_->SetVisible(!is_security_state_visible); 526 location_icon_decoration_->SetVisible(!is_security_state_visible);
526 security_state_bubble_decoration_->SetVisible(is_security_state_visible); 527 security_state_bubble_decoration_->SetVisible(is_security_state_visible);
527 528
528 // Don't change the label if the bubble is in the process of animating 529 // Don't change the label if the bubble is in the process of animating
529 // out the old one. 530 // out the old one.
530 base::string16 label(GetToolbarModel()->GetSecureVerboseText()); 531 base::string16 label(GetToolbarModel()->GetSecureVerboseText());
531 if (!security_state_bubble_decoration_->AnimatingOut()) { 532 if (!security_state_bubble_decoration_->AnimatingOut()) {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 OnDecorationsChanged(); 954 OnDecorationsChanged();
954 } 955 }
955 956
956 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { 957 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() {
957 std::vector<LocationBarDecoration*> decorations = GetDecorations(); 958 std::vector<LocationBarDecoration*> decorations = GetDecorations();
958 std::vector<NSView*> views; 959 std::vector<NSView*> views;
959 for (auto* decoration : decorations) 960 for (auto* decoration : decorations)
960 views.push_back(decoration->GetAccessibilityView()); 961 views.push_back(decoration->GetAccessibilityView());
961 return views; 962 return views;
962 } 963 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698