| 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 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 18 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/command_updater.h" | 20 #include "chrome/browser/command_updater.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/search/search.h" | 22 #include "chrome/browser/search/search.h" |
| 23 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_commands.h" |
| 25 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
| 26 #import "chrome/browser/ui/cocoa/background_gradient_view.h" | 27 #import "chrome/browser/ui/cocoa/background_gradient_view.h" |
| 27 #include "chrome/browser/ui/cocoa/drag_util.h" | 28 #include "chrome/browser/ui/cocoa/drag_util.h" |
| 28 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" | 29 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" |
| 29 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" | 30 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" |
| 30 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 31 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
| 31 #import "chrome/browser/ui/cocoa/gradient_button_cell.h" | 32 #import "chrome/browser/ui/cocoa/gradient_button_cell.h" |
| 32 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 33 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 33 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" | 34 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
| 34 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 35 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 252 |
| 252 [backButton_ setOpenMenuOnRightClick:YES]; | 253 [backButton_ setOpenMenuOnRightClick:YES]; |
| 253 [forwardButton_ setOpenMenuOnRightClick:YES]; | 254 [forwardButton_ setOpenMenuOnRightClick:YES]; |
| 254 | 255 |
| 255 [backButton_ setHandleMiddleClick:YES]; | 256 [backButton_ setHandleMiddleClick:YES]; |
| 256 [forwardButton_ setHandleMiddleClick:YES]; | 257 [forwardButton_ setHandleMiddleClick:YES]; |
| 257 [reloadButton_ setHandleMiddleClick:YES]; | 258 [reloadButton_ setHandleMiddleClick:YES]; |
| 258 [homeButton_ setHandleMiddleClick:YES]; | 259 [homeButton_ setHandleMiddleClick:YES]; |
| 259 | 260 |
| 260 [self initCommandStatus:commands_]; | 261 [self initCommandStatus:commands_]; |
| 262 [reloadButton_ setCommandUpdater:commands_]; |
| 261 | 263 |
| 262 locationBarView_.reset(new LocationBarViewMac(locationBar_, commands_, | 264 locationBarView_.reset(new LocationBarViewMac(locationBar_, commands_, |
| 263 profile_, browser_)); | 265 profile_, browser_)); |
| 264 [locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; | 266 [locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; |
| 265 | 267 |
| 266 // Register pref observers for the optional home and page/options buttons | 268 // Register pref observers for the optional home and page/options buttons |
| 267 // and then add them to the toolbar based on those prefs. | 269 // and then add them to the toolbar based on those prefs. |
| 268 PrefService* prefs = profile_->GetPrefs(); | 270 PrefService* prefs = profile_->GetPrefs(); |
| 269 showHomeButton_.Init( | 271 showHomeButton_.Init( |
| 270 prefs::kShowHomeButton, prefs, | 272 prefs::kShowHomeButton, prefs, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 435 } |
| 434 | 436 |
| 435 - (void)updateToolbarWithContents:(WebContents*)tab { | 437 - (void)updateToolbarWithContents:(WebContents*)tab { |
| 436 locationBarView_->Update(tab); | 438 locationBarView_->Update(tab); |
| 437 | 439 |
| 438 [locationBar_ updateMouseTracking]; | 440 [locationBar_ updateMouseTracking]; |
| 439 | 441 |
| 440 if (browserActionsController_.get()) { | 442 if (browserActionsController_.get()) { |
| 441 [browserActionsController_ update]; | 443 [browserActionsController_ update]; |
| 442 } | 444 } |
| 445 |
| 446 BOOL needReloadMenu = chrome::IsDebuggerAttachedToCurrentTab(browser_); |
| 447 [reloadButton_ setMenuEnabled:needReloadMenu]; |
| 443 } | 448 } |
| 444 | 449 |
| 445 - (void)setStarredState:(BOOL)isStarred { | 450 - (void)setStarredState:(BOOL)isStarred { |
| 446 locationBarView_->SetStarred(isStarred); | 451 locationBarView_->SetStarred(isStarred); |
| 447 } | 452 } |
| 448 | 453 |
| 449 - (void)setTranslateIconLit:(BOOL)on { | 454 - (void)setTranslateIconLit:(BOOL)on { |
| 450 locationBarView_->SetTranslateIconLit(on); | 455 locationBarView_->SetTranslateIconLit(on); |
| 451 } | 456 } |
| 452 | 457 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 831 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 827 // Do nothing. | 832 // Do nothing. |
| 828 } | 833 } |
| 829 | 834 |
| 830 // (URLDropTargetController protocol) | 835 // (URLDropTargetController protocol) |
| 831 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 836 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 832 return drag_util::IsUnsupportedDropData(profile_, info); | 837 return drag_util::IsUnsupportedDropData(profile_, info); |
| 833 } | 838 } |
| 834 | 839 |
| 835 @end | 840 @end |
| OLD | NEW |