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

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

Issue 1305143008: [Mac] Implement LocationBarViewMac::UpdateLocationBarVisibility() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 5 years, 2 months 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
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 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/extensions/location_bar_controller.h" 22 #include "chrome/browser/extensions/location_bar_controller.h"
23 #include "chrome/browser/extensions/tab_helper.h" 23 #include "chrome/browser/extensions/tab_helper.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/search/instant_service.h" 25 #include "chrome/browser/search/instant_service.h"
26 #include "chrome/browser/search/instant_service_factory.h" 26 #include "chrome/browser/search/instant_service_factory.h"
27 #include "chrome/browser/search/search.h" 27 #include "chrome/browser/search/search.h"
28 #include "chrome/browser/search_engines/template_url_service_factory.h" 28 #include "chrome/browser/search_engines/template_url_service_factory.h"
29 #include "chrome/browser/translate/chrome_translate_client.h" 29 #include "chrome/browser/translate/chrome_translate_client.h"
30 #include "chrome/browser/translate/translate_service.h" 30 #include "chrome/browser/translate/translate_service.h"
31 #include "chrome/browser/ui/browser_list.h" 31 #include "chrome/browser/ui/browser_list.h"
32 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
32 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h " 33 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h "
33 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 34 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
34 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" 35 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h"
35 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 36 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
36 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 37 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
37 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" 38 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h"
38 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" 39 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h"
39 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" 40 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h"
40 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" 41 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h"
41 #import "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h" 42 #import "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ev_bubble_decoration_( 97 ev_bubble_decoration_(
97 new EVBubbleDecoration(location_icon_decoration_.get())), 98 new EVBubbleDecoration(location_icon_decoration_.get())),
98 star_decoration_(new StarDecoration(command_updater)), 99 star_decoration_(new StarDecoration(command_updater)),
99 translate_decoration_(new TranslateDecoration(command_updater)), 100 translate_decoration_(new TranslateDecoration(command_updater)),
100 zoom_decoration_(new ZoomDecoration(this)), 101 zoom_decoration_(new ZoomDecoration(this)),
101 keyword_hint_decoration_(new KeywordHintDecoration()), 102 keyword_hint_decoration_(new KeywordHintDecoration()),
102 mic_search_decoration_(new MicSearchDecoration(command_updater)), 103 mic_search_decoration_(new MicSearchDecoration(command_updater)),
103 manage_passwords_decoration_( 104 manage_passwords_decoration_(
104 new ManagePasswordsDecoration(command_updater, this)), 105 new ManagePasswordsDecoration(command_updater, this)),
105 browser_(browser), 106 browser_(browser),
107 visible_(true),
106 weak_ptr_factory_(this) { 108 weak_ptr_factory_(this) {
107 for (ContentSettingsType type : 109 for (ContentSettingsType type :
108 ContentSettingBubbleModel::GetSupportedBubbleTypes()) { 110 ContentSettingBubbleModel::GetSupportedBubbleTypes()) {
109 content_setting_decorations_.push_back( 111 content_setting_decorations_.push_back(
110 new ContentSettingDecoration(type, this, profile)); 112 new ContentSettingDecoration(type, this, profile));
111 } 113 }
112 114
113 edit_bookmarks_enabled_.Init( 115 edit_bookmarks_enabled_.Init(
114 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), 116 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(),
115 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, 117 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 [field_ updateMouseTracking]; 194 [field_ updateMouseTracking];
193 [field_ setNeedsDisplay:YES]; 195 [field_ setNeedsDisplay:YES];
194 } 196 }
195 197
196 void LocationBarViewMac::UpdateBookmarkStarVisibility() { 198 void LocationBarViewMac::UpdateBookmarkStarVisibility() {
197 star_decoration_->SetVisible(IsStarEnabled()); 199 star_decoration_->SetVisible(IsStarEnabled());
198 } 200 }
199 201
200 void LocationBarViewMac::UpdateLocationBarVisibility(bool visible, 202 void LocationBarViewMac::UpdateLocationBarVisibility(bool visible,
201 bool animate) { 203 bool animate) {
202 // Not implemented on Mac. 204 // The location bar is held within the toolbar, so its visibility is
205 // controlled by the visibility of the toolbar. In turn, the toolbar
206 // visibility is controlled by the BWC. If we have requested a visibility
207 // change, ask the BWC for the current view to tell the toolbar controller
208 // to update.
209 if (visible != visible_) {
210 [[BrowserWindowController browserWindowControllerForView:field_]
211 updateToolbarVisibility:visible withAnimation:animate];
tapted 2015/10/12 23:56:43 We should be able to find a way to call it directl
dominickn 2015/10/15 06:22:28 Done.
212 visible_ = visible;
213 }
203 } 214 }
204 215
205 bool LocationBarViewMac::ShowPageActionPopup( 216 bool LocationBarViewMac::ShowPageActionPopup(
206 const extensions::Extension* extension, bool grant_active_tab) { 217 const extensions::Extension* extension, bool grant_active_tab) {
207 for (ScopedVector<PageActionDecoration>::iterator iter = 218 for (ScopedVector<PageActionDecoration>::iterator iter =
208 page_action_decorations_.begin(); 219 page_action_decorations_.begin();
209 iter != page_action_decorations_.end(); ++iter) { 220 iter != page_action_decorations_.end(); ++iter) {
210 if ((*iter)->GetExtension() == extension) 221 if ((*iter)->GetExtension() == extension)
211 return (*iter)->ActivatePageAction(grant_active_tab); 222 return (*iter)->ActivatePageAction(grant_active_tab);
212 } 223 }
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 725 }
715 726
716 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { 727 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() {
717 bool is_visible = !GetToolbarModel()->input_in_progress() && 728 bool is_visible = !GetToolbarModel()->input_in_progress() &&
718 browser_->search_model()->voice_search_supported(); 729 browser_->search_model()->voice_search_supported();
719 if (mic_search_decoration_->IsVisible() == is_visible) 730 if (mic_search_decoration_->IsVisible() == is_visible)
720 return false; 731 return false;
721 mic_search_decoration_->SetVisible(is_visible); 732 mic_search_decoration_->SetVisible(is_visible);
722 return true; 733 return true;
723 } 734 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698