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

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

Issue 233623002: Shows the info bubble when the location bar icon is clicked in the origin chip. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comment tweaks. Created 6 years, 8 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 prefs::kEditBookmarksEnabled, profile->GetPrefs(), 156 prefs::kEditBookmarksEnabled, profile->GetPrefs(),
157 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, 157 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged,
158 base::Unretained(this))); 158 base::Unretained(this)));
159 159
160 browser_->search_model()->AddObserver(this); 160 browser_->search_model()->AddObserver(this);
161 161
162 [[field_ cell] setIsPopupMode: 162 [[field_ cell] setIsPopupMode:
163 !browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)]; 163 !browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)];
164 164
165 if (chrome::ShouldDisplayOriginChipV2()) 165 if (chrome::ShouldDisplayOriginChipV2())
166 origin_chip_decoration_.reset(new OriginChipDecoration(this)); 166 origin_chip_decoration_.reset(new OriginChipDecoration(
167 this, location_icon_decoration_.get()));
167 } 168 }
168 169
169 LocationBarViewMac::~LocationBarViewMac() { 170 LocationBarViewMac::~LocationBarViewMac() {
170 // Disconnect from cell in case it outlives us. 171 // Disconnect from cell in case it outlives us.
171 [[field_ cell] clearDecorations]; 172 [[field_ cell] clearDecorations];
172 173
173 browser_->search_model()->RemoveObserver(this); 174 browser_->search_model()->RemoveObserver(this);
174 } 175 }
175 176
176 void LocationBarViewMac::ShowFirstRunBubble() { 177 void LocationBarViewMac::ShowFirstRunBubble() {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 298 }
298 } 299 }
299 300
300 NOTREACHED(); 301 NOTREACHED();
301 return NULL; 302 return NULL;
302 } 303 }
303 304
304 void LocationBarViewMac::TestPageActionPressed(size_t index) { 305 void LocationBarViewMac::TestPageActionPressed(size_t index) {
305 DCHECK_LT(index, page_action_decorations_.size()); 306 DCHECK_LT(index, page_action_decorations_.size());
306 if (index < page_action_decorations_.size()) 307 if (index < page_action_decorations_.size())
307 page_action_decorations_[index]->OnMousePressed(NSZeroRect); 308 page_action_decorations_[index]->OnMousePressed(NSZeroRect, NSZeroPoint);
308 } 309 }
309 310
310 bool LocationBarViewMac::GetBookmarkStarVisibility() { 311 bool LocationBarViewMac::GetBookmarkStarVisibility() {
311 DCHECK(star_decoration_.get()); 312 DCHECK(star_decoration_.get());
312 return star_decoration_->IsVisible(); 313 return star_decoration_->IsVisible();
313 } 314 }
314 315
315 void LocationBarViewMac::SetEditable(bool editable) { 316 void LocationBarViewMac::SetEditable(bool editable) {
316 [field_ setEditable:editable ? YES : NO]; 317 [field_ setEditable:editable ? YES : NO];
317 UpdateStarDecorationVisibility(); 318 UpdateStarDecorationVisibility();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const { 355 NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const {
355 DCHECK(IsStarEnabled()); 356 DCHECK(IsStarEnabled());
356 return [field_ bubblePointForDecoration:star_decoration_.get()]; 357 return [field_ bubblePointForDecoration:star_decoration_.get()];
357 } 358 }
358 359
359 NSPoint LocationBarViewMac::GetTranslateBubblePoint() const { 360 NSPoint LocationBarViewMac::GetTranslateBubblePoint() const {
360 return [field_ bubblePointForDecoration:translate_decoration_.get()]; 361 return [field_ bubblePointForDecoration:translate_decoration_.get()];
361 } 362 }
362 363
363 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { 364 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const {
364 if (ev_bubble_decoration_->IsVisible()) { 365 if (origin_chip_decoration_ && origin_chip_decoration_->IsVisible()) {
366 return [field_ bubblePointForDecoration:origin_chip_decoration_.get()];
367 } else if (ev_bubble_decoration_->IsVisible()) {
365 return [field_ bubblePointForDecoration:ev_bubble_decoration_.get()]; 368 return [field_ bubblePointForDecoration:ev_bubble_decoration_.get()];
366 } else { 369 } else {
367 return [field_ bubblePointForDecoration:location_icon_decoration_.get()]; 370 return [field_ bubblePointForDecoration:location_icon_decoration_.get()];
368 } 371 }
369 } 372 }
370 373
371 NSPoint LocationBarViewMac::GetGeneratedCreditCardBubblePoint() const { 374 NSPoint LocationBarViewMac::GetGeneratedCreditCardBubblePoint() const {
372 return 375 return
373 [field_ bubblePointForDecoration:generated_credit_card_decoration_.get()]; 376 [field_ bubblePointForDecoration:generated_credit_card_decoration_.get()];
374 } 377 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 } 791 }
789 792
790 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { 793 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() {
791 bool is_visible = !GetToolbarModel()->input_in_progress() && 794 bool is_visible = !GetToolbarModel()->input_in_progress() &&
792 browser_->search_model()->voice_search_supported(); 795 browser_->search_model()->voice_search_supported();
793 if (mic_search_decoration_->IsVisible() == is_visible) 796 if (mic_search_decoration_->IsVisible() == is_visible)
794 return false; 797 return false;
795 mic_search_decoration_->SetVisible(is_visible); 798 mic_search_decoration_->SetVisible(is_visible);
796 return true; 799 return true;
797 } 800 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698