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

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

Issue 444603003: Hook up the Mac password bubble to the browser and add browser tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix views build Created 6 years, 3 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 | Annotate | Revision Log
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 new EVBubbleDecoration(location_icon_decoration_.get())), 126 new EVBubbleDecoration(location_icon_decoration_.get())),
127 star_decoration_(new StarDecoration(command_updater)), 127 star_decoration_(new StarDecoration(command_updater)),
128 translate_decoration_(new TranslateDecoration(command_updater)), 128 translate_decoration_(new TranslateDecoration(command_updater)),
129 zoom_decoration_(new ZoomDecoration(this)), 129 zoom_decoration_(new ZoomDecoration(this)),
130 keyword_hint_decoration_(new KeywordHintDecoration()), 130 keyword_hint_decoration_(new KeywordHintDecoration()),
131 mic_search_decoration_(new MicSearchDecoration(command_updater)), 131 mic_search_decoration_(new MicSearchDecoration(command_updater)),
132 generated_credit_card_decoration_( 132 generated_credit_card_decoration_(
133 new GeneratedCreditCardDecoration(this)), 133 new GeneratedCreditCardDecoration(this)),
134 search_button_decoration_(new SearchButtonDecoration(this)), 134 search_button_decoration_(new SearchButtonDecoration(this)),
135 manage_passwords_decoration_( 135 manage_passwords_decoration_(
136 new ManagePasswordsDecoration(command_updater)), 136 new ManagePasswordsDecoration(command_updater, this)),
137 browser_(browser), 137 browser_(browser),
138 weak_ptr_factory_(this) { 138 weak_ptr_factory_(this) {
139 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 139 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
140 DCHECK_EQ(i, content_setting_decorations_.size()); 140 DCHECK_EQ(i, content_setting_decorations_.size());
141 ContentSettingsType type = static_cast<ContentSettingsType>(i); 141 ContentSettingsType type = static_cast<ContentSettingsType>(i);
142 content_setting_decorations_.push_back( 142 content_setting_decorations_.push_back(
143 new ContentSettingDecoration(type, this, profile)); 143 new ContentSettingDecoration(type, this, profile));
144 } 144 }
145 145
146 registrar_.Add( 146 registrar_.Add(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 if (RefreshContentSettingsDecorations()) 215 if (RefreshContentSettingsDecorations())
216 OnDecorationsChanged(); 216 OnDecorationsChanged();
217 } 217 }
218 218
219 void LocationBarViewMac::UpdateManagePasswordsIconAndBubble() { 219 void LocationBarViewMac::UpdateManagePasswordsIconAndBubble() {
220 WebContents* web_contents = GetWebContents(); 220 WebContents* web_contents = GetWebContents();
221 if (!web_contents) 221 if (!web_contents)
222 return; 222 return;
223 ManagePasswordsUIController::FromWebContents(web_contents) 223 ManagePasswordsUIController::FromWebContents(web_contents)
224 ->UpdateIconAndBubbleState(manage_passwords_decoration_->icon()); 224 ->UpdateIconAndBubbleState(manage_passwords_decoration_->icon());
225 OnDecorationsChanged();
225 } 226 }
226 227
227 void LocationBarViewMac::UpdatePageActions() { 228 void LocationBarViewMac::UpdatePageActions() {
228 RefreshPageActionDecorations(); 229 RefreshPageActionDecorations();
229 Layout(); 230 Layout();
230 } 231 }
231 232
232 void LocationBarViewMac::InvalidatePageActions() { 233 void LocationBarViewMac::InvalidatePageActions() {
233 DeletePageActionDecorations(); 234 DeletePageActionDecorations();
234 Layout(); 235 Layout();
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // near the top left corner (unanchored). 520 // near the top left corner (unanchored).
520 NOTREACHED(); 521 NOTREACHED();
521 return NSZeroPoint; 522 return NSZeroPoint;
522 } 523 }
523 524
524 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); 525 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame);
525 return [field_ convertPoint:bubble_point toView:nil]; 526 return [field_ convertPoint:bubble_point toView:nil];
526 } 527 }
527 528
528 void LocationBarViewMac::Update(const WebContents* contents) { 529 void LocationBarViewMac::Update(const WebContents* contents) {
530 UpdateManagePasswordsIconAndBubble();
529 UpdateStarDecorationVisibility(); 531 UpdateStarDecorationVisibility();
530 UpdateTranslateDecoration(); 532 UpdateTranslateDecoration();
531 UpdateZoomDecoration(); 533 UpdateZoomDecoration();
532 RefreshPageActionDecorations(); 534 RefreshPageActionDecorations();
533 RefreshContentSettingsDecorations(); 535 RefreshContentSettingsDecorations();
534 UpdateMicSearchDecorationVisibility(); 536 UpdateMicSearchDecorationVisibility();
535 UpdateGeneratedCreditCardView(); 537 UpdateGeneratedCreditCardView();
536 if (contents) 538 if (contents)
537 omnibox_view_->OnTabChanged(contents); 539 omnibox_view_->OnTabChanged(contents);
538 else 540 else
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 795 }
794 796
795 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { 797 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() {
796 bool is_visible = !GetToolbarModel()->input_in_progress() && 798 bool is_visible = !GetToolbarModel()->input_in_progress() &&
797 browser_->search_model()->voice_search_supported(); 799 browser_->search_model()->voice_search_supported();
798 if (mic_search_decoration_->IsVisible() == is_visible) 800 if (mic_search_decoration_->IsVisible() == is_visible)
799 return false; 801 return false;
800 mic_search_decoration_->SetVisible(is_visible); 802 mic_search_decoration_->SetVisible(is_visible);
801 return true; 803 return true;
802 } 804 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698