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

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

Issue 1303733002: rAc Wallet extirpation, round 2: remove generated card bubble code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another reference Created 5 years, 4 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 18 matching lines...) Expand all
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/content_settings/content_setting_bubble_cocoa.h " 32 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h "
33 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 33 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
34 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" 34 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h"
35 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 35 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
36 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 36 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
37 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" 37 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h"
38 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" 38 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h"
39 #import "chrome/browser/ui/cocoa/location_bar/generated_credit_card_decoration.h "
40 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" 39 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h"
41 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" 40 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h"
42 #import "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h" 41 #import "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h"
43 #import "chrome/browser/ui/cocoa/location_bar/mic_search_decoration.h" 42 #import "chrome/browser/ui/cocoa/location_bar/mic_search_decoration.h"
44 #import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h" 43 #import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h"
45 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" 44 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h"
46 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" 45 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h"
47 #import "chrome/browser/ui/cocoa/location_bar/translate_decoration.h" 46 #import "chrome/browser/ui/cocoa/location_bar/translate_decoration.h"
48 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" 47 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h"
49 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 48 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 field_(field), 93 field_(field),
95 location_icon_decoration_(new LocationIconDecoration(this)), 94 location_icon_decoration_(new LocationIconDecoration(this)),
96 selected_keyword_decoration_(new SelectedKeywordDecoration()), 95 selected_keyword_decoration_(new SelectedKeywordDecoration()),
97 ev_bubble_decoration_( 96 ev_bubble_decoration_(
98 new EVBubbleDecoration(location_icon_decoration_.get())), 97 new EVBubbleDecoration(location_icon_decoration_.get())),
99 star_decoration_(new StarDecoration(command_updater)), 98 star_decoration_(new StarDecoration(command_updater)),
100 translate_decoration_(new TranslateDecoration(command_updater)), 99 translate_decoration_(new TranslateDecoration(command_updater)),
101 zoom_decoration_(new ZoomDecoration(this)), 100 zoom_decoration_(new ZoomDecoration(this)),
102 keyword_hint_decoration_(new KeywordHintDecoration()), 101 keyword_hint_decoration_(new KeywordHintDecoration()),
103 mic_search_decoration_(new MicSearchDecoration(command_updater)), 102 mic_search_decoration_(new MicSearchDecoration(command_updater)),
104 generated_credit_card_decoration_(
105 new GeneratedCreditCardDecoration(this)),
106 manage_passwords_decoration_( 103 manage_passwords_decoration_(
107 new ManagePasswordsDecoration(command_updater, this)), 104 new ManagePasswordsDecoration(command_updater, this)),
108 browser_(browser), 105 browser_(browser),
109 weak_ptr_factory_(this) { 106 weak_ptr_factory_(this) {
110 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 107 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
111 DCHECK_EQ(i, content_setting_decorations_.size()); 108 DCHECK_EQ(i, content_setting_decorations_.size());
112 ContentSettingsType type = static_cast<ContentSettingsType>(i); 109 ContentSettingsType type = static_cast<ContentSettingsType>(i);
113 content_setting_decorations_.push_back( 110 content_setting_decorations_.push_back(
114 new ContentSettingDecoration(type, this, profile)); 111 new ContentSettingDecoration(type, this, profile));
115 } 112 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if ((*iter)->GetExtension() == extension) 211 if ((*iter)->GetExtension() == extension)
215 return (*iter)->ActivatePageAction(grant_active_tab); 212 return (*iter)->ActivatePageAction(grant_active_tab);
216 } 213 }
217 return false; 214 return false;
218 } 215 }
219 216
220 void LocationBarViewMac::UpdateOpenPDFInReaderPrompt() { 217 void LocationBarViewMac::UpdateOpenPDFInReaderPrompt() {
221 // Not implemented on Mac. 218 // Not implemented on Mac.
222 } 219 }
223 220
224 void LocationBarViewMac::UpdateGeneratedCreditCardView() {
225 generated_credit_card_decoration_->Update();
226 }
227
228 void LocationBarViewMac::SaveStateToContents(WebContents* contents) { 221 void LocationBarViewMac::SaveStateToContents(WebContents* contents) {
229 // TODO(shess): Why SaveStateToContents vs SaveStateToTab? 222 // TODO(shess): Why SaveStateToContents vs SaveStateToTab?
230 omnibox_view_->SaveStateToTab(contents); 223 omnibox_view_->SaveStateToTab(contents);
231 } 224 }
232 225
233 void LocationBarViewMac::Revert() { 226 void LocationBarViewMac::Revert() {
234 omnibox_view_->RevertAll(); 227 omnibox_view_->RevertAll();
235 } 228 }
236 229
237 const OmniboxView* LocationBarViewMac::GetOmniboxView() const { 230 const OmniboxView* LocationBarViewMac::GetOmniboxView() const {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 351 }
359 352
360 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { 353 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const {
361 if (ev_bubble_decoration_->IsVisible()) { 354 if (ev_bubble_decoration_->IsVisible()) {
362 return [field_ bubblePointForDecoration:ev_bubble_decoration_.get()]; 355 return [field_ bubblePointForDecoration:ev_bubble_decoration_.get()];
363 } else { 356 } else {
364 return [field_ bubblePointForDecoration:location_icon_decoration_.get()]; 357 return [field_ bubblePointForDecoration:location_icon_decoration_.get()];
365 } 358 }
366 } 359 }
367 360
368 NSPoint LocationBarViewMac::GetGeneratedCreditCardBubblePoint() const {
369 return
370 [field_ bubblePointForDecoration:generated_credit_card_decoration_.get()];
371 }
372
373 void LocationBarViewMac::OnDecorationsChanged() { 361 void LocationBarViewMac::OnDecorationsChanged() {
374 // TODO(shess): The field-editor frame and cursor rects should not 362 // TODO(shess): The field-editor frame and cursor rects should not
375 // change, here. 363 // change, here.
376 [field_ updateMouseTracking]; 364 [field_ updateMouseTracking];
377 [field_ resetFieldEditorFrameIfNeeded]; 365 [field_ resetFieldEditorFrameIfNeeded];
378 [field_ setNeedsDisplay:YES]; 366 [field_ setNeedsDisplay:YES];
379 } 367 }
380 368
381 // TODO(shess): This function should over time grow to closely match 369 // TODO(shess): This function should over time grow to closely match
382 // the views Layout() function. 370 // the views Layout() function.
383 void LocationBarViewMac::Layout() { 371 void LocationBarViewMac::Layout() {
384 AutocompleteTextFieldCell* cell = [field_ cell]; 372 AutocompleteTextFieldCell* cell = [field_ cell];
385 373
386 // Reset the left-hand decorations. 374 // Reset the left-hand decorations.
387 // TODO(shess): Shortly, this code will live somewhere else, like in 375 // TODO(shess): Shortly, this code will live somewhere else, like in
388 // the constructor. I am still wrestling with how best to deal with 376 // the constructor. I am still wrestling with how best to deal with
389 // right-hand decorations, which are not a static set. 377 // right-hand decorations, which are not a static set.
390 [cell clearDecorations]; 378 [cell clearDecorations];
391 [cell addLeftDecoration:location_icon_decoration_.get()]; 379 [cell addLeftDecoration:location_icon_decoration_.get()];
392 [cell addLeftDecoration:selected_keyword_decoration_.get()]; 380 [cell addLeftDecoration:selected_keyword_decoration_.get()];
393 [cell addLeftDecoration:ev_bubble_decoration_.get()]; 381 [cell addLeftDecoration:ev_bubble_decoration_.get()];
394 [cell addRightDecoration:star_decoration_.get()]; 382 [cell addRightDecoration:star_decoration_.get()];
395 [cell addRightDecoration:translate_decoration_.get()]; 383 [cell addRightDecoration:translate_decoration_.get()];
396 [cell addRightDecoration:zoom_decoration_.get()]; 384 [cell addRightDecoration:zoom_decoration_.get()];
397 [cell addRightDecoration:generated_credit_card_decoration_.get()];
398 [cell addRightDecoration:manage_passwords_decoration_.get()]; 385 [cell addRightDecoration:manage_passwords_decoration_.get()];
399 386
400 // Note that display order is right to left. 387 // Note that display order is right to left.
401 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { 388 for (size_t i = 0; i < page_action_decorations_.size(); ++i) {
402 [cell addRightDecoration:page_action_decorations_[i]]; 389 [cell addRightDecoration:page_action_decorations_[i]];
403 } 390 }
404 391
405 for (ScopedVector<ContentSettingDecoration>::iterator i = 392 for (ScopedVector<ContentSettingDecoration>::iterator i =
406 content_setting_decorations_.begin(); 393 content_setting_decorations_.begin();
407 i != content_setting_decorations_.end(); ++i) { 394 i != content_setting_decorations_.end(); ++i) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 } 503 }
517 504
518 void LocationBarViewMac::Update(const WebContents* contents) { 505 void LocationBarViewMac::Update(const WebContents* contents) {
519 UpdateManagePasswordsIconAndBubble(); 506 UpdateManagePasswordsIconAndBubble();
520 UpdateBookmarkStarVisibility(); 507 UpdateBookmarkStarVisibility();
521 UpdateTranslateDecoration(); 508 UpdateTranslateDecoration();
522 UpdateZoomDecoration(/*default_zoom_changed=*/false); 509 UpdateZoomDecoration(/*default_zoom_changed=*/false);
523 RefreshPageActionDecorations(); 510 RefreshPageActionDecorations();
524 RefreshContentSettingsDecorations(); 511 RefreshContentSettingsDecorations();
525 UpdateMicSearchDecorationVisibility(); 512 UpdateMicSearchDecorationVisibility();
526 UpdateGeneratedCreditCardView();
527 if (contents) 513 if (contents)
528 omnibox_view_->OnTabChanged(contents); 514 omnibox_view_->OnTabChanged(contents);
529 else 515 else
530 omnibox_view_->Update(); 516 omnibox_view_->Update();
531 OnChanged(); 517 OnChanged();
532 } 518 }
533 519
534 void LocationBarViewMac::UpdateWithoutTabRestore() { 520 void LocationBarViewMac::UpdateWithoutTabRestore() {
535 Update(nullptr); 521 Update(nullptr);
536 } 522 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 } 715 }
730 716
731 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { 717 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() {
732 bool is_visible = !GetToolbarModel()->input_in_progress() && 718 bool is_visible = !GetToolbarModel()->input_in_progress() &&
733 browser_->search_model()->voice_search_supported(); 719 browser_->search_model()->voice_search_supported();
734 if (mic_search_decoration_->IsVisible() == is_visible) 720 if (mic_search_decoration_->IsVisible() == is_visible)
735 return false; 721 return false;
736 mic_search_decoration_->SetVisible(is_visible); 722 mic_search_decoration_->SetVisible(is_visible);
737 return true; 723 return true;
738 } 724 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h ('k') | chrome/browser/ui/location_bar/location_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698