| OLD | NEW |
| 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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 short_name = TemplateURLServiceFactory::GetForProfile(profile())-> | 452 short_name = TemplateURLServiceFactory::GetForProfile(profile())-> |
| 453 GetKeywordShortName(keyword, &is_extension_keyword); | 453 GetKeywordShortName(keyword, &is_extension_keyword); |
| 454 } | 454 } |
| 455 | 455 |
| 456 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); | 456 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); |
| 457 if (!keyword.empty() && !is_keyword_hint) { | 457 if (!keyword.empty() && !is_keyword_hint) { |
| 458 // Switch from location icon to keyword mode. | 458 // Switch from location icon to keyword mode. |
| 459 location_icon_decoration_->SetVisible(false); | 459 location_icon_decoration_->SetVisible(false); |
| 460 selected_keyword_decoration_->SetVisible(true); | 460 selected_keyword_decoration_->SetVisible(true); |
| 461 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); | 461 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); |
| 462 // Note: the first time through this code path the |
| 463 // |selected_keyword_decoration_| has no image set because under Material |
| 464 // Design we need to set its color, which we cannot do until we know the |
| 465 // theme (by being installed in a browser window). |
| 462 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); | 466 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); |
| 463 } else if (ShouldShowEVBubble()) { | 467 } else if (ShouldShowEVBubble()) { |
| 464 // Switch from location icon to show the EV bubble instead. | 468 // Switch from location icon to show the EV bubble instead. |
| 465 location_icon_decoration_->SetVisible(false); | 469 location_icon_decoration_->SetVisible(false); |
| 466 ev_bubble_decoration_->SetVisible(true); | 470 ev_bubble_decoration_->SetVisible(true); |
| 467 | 471 |
| 468 base::string16 label(GetToolbarModel()->GetEVCertName()); | 472 base::string16 label(GetToolbarModel()->GetEVCertName()); |
| 469 ev_bubble_decoration_->SetFullLabel(base::SysUTF16ToNSString(label)); | 473 ev_bubble_decoration_->SetFullLabel(base::SysUTF16ToNSString(label)); |
| 470 } else if (!keyword.empty() && is_keyword_hint) { | 474 } else if (!keyword.empty() && is_keyword_hint) { |
| 471 keyword_hint_decoration_->SetKeyword(short_name, | 475 keyword_hint_decoration_->SetKeyword(short_name, |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 return zoom_decoration_->UpdateIfNecessary( | 809 return zoom_decoration_->UpdateIfNecessary( |
| 806 ui_zoom::ZoomController::FromWebContents(web_contents), | 810 ui_zoom::ZoomController::FromWebContents(web_contents), |
| 807 default_zoom_changed, | 811 default_zoom_changed, |
| 808 in_dark_mode); | 812 in_dark_mode); |
| 809 } | 813 } |
| 810 | 814 |
| 811 void LocationBarViewMac::OnDefaultZoomLevelChanged() { | 815 void LocationBarViewMac::OnDefaultZoomLevelChanged() { |
| 812 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) | 816 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) |
| 813 OnDecorationsChanged(); | 817 OnDecorationsChanged(); |
| 814 } | 818 } |
| OLD | NEW |