| 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 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool LocationBarViewMac::IsEditable() { | 326 bool LocationBarViewMac::IsEditable() { |
| 327 return [field_ isEditable] ? true : false; | 327 return [field_ isEditable] ? true : false; |
| 328 } | 328 } |
| 329 | 329 |
| 330 void LocationBarViewMac::SetStarred(bool starred) { | 330 void LocationBarViewMac::SetStarred(bool starred) { |
| 331 if (star_decoration_->starred() == starred) | 331 if (star_decoration_->starred() == starred) |
| 332 return; | 332 return; |
| 333 | 333 |
| 334 star_decoration_->SetStarred(starred); | 334 star_decoration_->SetStarred(starred, |
| 335 [[field_ window] inIncognitoModeWithSystemTheme]); |
| 335 UpdateBookmarkStarVisibility(); | 336 UpdateBookmarkStarVisibility(); |
| 336 OnDecorationsChanged(); | 337 OnDecorationsChanged(); |
| 337 } | 338 } |
| 338 | 339 |
| 339 void LocationBarViewMac::SetTranslateIconLit(bool on) { | 340 void LocationBarViewMac::SetTranslateIconLit(bool on) { |
| 340 translate_decoration_->SetLit(on); | 341 translate_decoration_->SetLit(on); |
| 341 OnDecorationsChanged(); | 342 OnDecorationsChanged(); |
| 342 } | 343 } |
| 343 | 344 |
| 344 void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) { | 345 void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 Update(nullptr); | 545 Update(nullptr); |
| 545 } | 546 } |
| 546 | 547 |
| 547 void LocationBarViewMac::OnChanged() { | 548 void LocationBarViewMac::OnChanged() { |
| 548 // Update the location-bar icon. | 549 // Update the location-bar icon. |
| 549 const int resource_id = omnibox_view_->GetIcon(); | 550 const int resource_id = omnibox_view_->GetIcon(); |
| 550 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); | 551 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); |
| 551 location_icon_decoration_->SetImage(image); | 552 location_icon_decoration_->SetImage(image); |
| 552 ev_bubble_decoration_->SetImage(image); | 553 ev_bubble_decoration_->SetImage(image); |
| 553 Layout(); | 554 Layout(); |
| 555 |
| 556 // Make sure we're displaying the correct icon color for a dark location bar. |
| 557 if ([[field_ window] inIncognitoModeWithSystemTheme]) { |
| 558 star_decoration_->SetStarred(star_decoration_->starred(), true); |
| 559 } |
| 554 } | 560 } |
| 555 | 561 |
| 556 void LocationBarViewMac::OnSetFocus() { | 562 void LocationBarViewMac::OnSetFocus() { |
| 557 // Update the keyword and search hint states. | 563 // Update the keyword and search hint states. |
| 558 OnChanged(); | 564 OnChanged(); |
| 559 } | 565 } |
| 560 | 566 |
| 561 void LocationBarViewMac::ShowURL() { | 567 void LocationBarViewMac::ShowURL() { |
| 562 omnibox_view_->ShowURL(); | 568 omnibox_view_->ShowURL(); |
| 563 } | 569 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 | 722 |
| 717 return zoom_decoration_->UpdateIfNecessary( | 723 return zoom_decoration_->UpdateIfNecessary( |
| 718 ui_zoom::ZoomController::FromWebContents(web_contents), | 724 ui_zoom::ZoomController::FromWebContents(web_contents), |
| 719 default_zoom_changed); | 725 default_zoom_changed); |
| 720 } | 726 } |
| 721 | 727 |
| 722 void LocationBarViewMac::OnDefaultZoomLevelChanged() { | 728 void LocationBarViewMac::OnDefaultZoomLevelChanged() { |
| 723 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) | 729 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) |
| 724 OnDecorationsChanged(); | 730 OnDecorationsChanged(); |
| 725 } | 731 } |
| OLD | NEW |