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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

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
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/ui/browser_finder.h" 32 #include "chrome/browser/ui/browser_finder.h"
33 #include "chrome/browser/ui/browser_instant_controller.h" 33 #include "chrome/browser/ui/browser_instant_controller.h"
34 #include "chrome/browser/ui/browser_window.h" 34 #include "chrome/browser/ui/browser_window.h"
35 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" 35 #include "chrome/browser/ui/passwords/manage_passwords_icon.h"
36 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 36 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" 37 #include "chrome/browser/ui/tabs/tab_strip_model.h"
38 #include "chrome/browser/ui/view_ids.h" 38 #include "chrome/browser/ui/view_ids.h"
39 #include "chrome/browser/ui/views/browser_dialogs.h" 39 #include "chrome/browser/ui/views/browser_dialogs.h"
40 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" 40 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
41 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" 41 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
42 #include "chrome/browser/ui/views/location_bar/generated_credit_card_view.h"
43 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" 42 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
44 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" 43 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
45 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 44 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
46 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" 45 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h"
47 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 46 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
48 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" 47 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
49 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" 48 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h"
50 #include "chrome/browser/ui/views/location_bar/star_view.h" 49 #include "chrome/browser/ui/views/location_bar/star_view.h"
51 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" 50 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h"
52 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" 51 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 omnibox_view_(NULL), 134 omnibox_view_(NULL),
136 delegate_(delegate), 135 delegate_(delegate),
137 location_icon_view_(NULL), 136 location_icon_view_(NULL),
138 ev_bubble_view_(NULL), 137 ev_bubble_view_(NULL),
139 ime_inline_autocomplete_view_(NULL), 138 ime_inline_autocomplete_view_(NULL),
140 selected_keyword_view_(NULL), 139 selected_keyword_view_(NULL),
141 suggested_text_view_(NULL), 140 suggested_text_view_(NULL),
142 keyword_hint_view_(NULL), 141 keyword_hint_view_(NULL),
143 mic_search_view_(NULL), 142 mic_search_view_(NULL),
144 zoom_view_(NULL), 143 zoom_view_(NULL),
145 generated_credit_card_view_(NULL),
146 open_pdf_in_reader_view_(NULL), 144 open_pdf_in_reader_view_(NULL),
147 manage_passwords_icon_view_(NULL), 145 manage_passwords_icon_view_(NULL),
148 translate_icon_view_(NULL), 146 translate_icon_view_(NULL),
149 star_view_(NULL), 147 star_view_(NULL),
150 size_animation_(this), 148 size_animation_(this),
151 is_popup_mode_(is_popup_mode), 149 is_popup_mode_(is_popup_mode),
152 show_focus_rect_(false), 150 show_focus_rect_(false),
153 template_url_service_(NULL), 151 template_url_service_(NULL),
154 dropdown_animation_offset_(0), 152 dropdown_animation_offset_(0),
155 web_contents_null_at_last_refresh_(true) { 153 web_contents_null_at_last_refresh_(true) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 286 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
289 ContentSettingImageView* content_blocked_view = 287 ContentSettingImageView* content_blocked_view =
290 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this, 288 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this,
291 bubble_font_list, text_color, 289 bubble_font_list, text_color,
292 background_color); 290 background_color);
293 content_setting_views_.push_back(content_blocked_view); 291 content_setting_views_.push_back(content_blocked_view);
294 content_blocked_view->SetVisible(false); 292 content_blocked_view->SetVisible(false);
295 AddChildView(content_blocked_view); 293 AddChildView(content_blocked_view);
296 } 294 }
297 295
298 generated_credit_card_view_ = new GeneratedCreditCardView(delegate_);
299 AddChildView(generated_credit_card_view_);
300
301 zoom_view_ = new ZoomView(delegate_); 296 zoom_view_ = new ZoomView(delegate_);
302 AddChildView(zoom_view_); 297 AddChildView(zoom_view_);
303 298
304 open_pdf_in_reader_view_ = new OpenPDFInReaderView(); 299 open_pdf_in_reader_view_ = new OpenPDFInReaderView();
305 AddChildView(open_pdf_in_reader_view_); 300 AddChildView(open_pdf_in_reader_view_);
306 301
307 manage_passwords_icon_view_ = new ManagePasswordsIconView(command_updater()); 302 manage_passwords_icon_view_ = new ManagePasswordsIconView(command_updater());
308 AddChildView(manage_passwords_icon_view_); 303 AddChildView(manage_passwords_icon_view_);
309 304
310 translate_icon_view_ = new TranslateIconView(command_updater()); 305 translate_icon_view_ = new TranslateIconView(command_updater());
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 const int icon_internal_padding = GetThemeProvider()->GetDisplayProperty( 471 const int icon_internal_padding = GetThemeProvider()->GetDisplayProperty(
477 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING); 472 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING);
478 gfx::Point icon_bottom(0, location_icon_view_->GetImageBounds().bottom() - 473 gfx::Point icon_bottom(0, location_icon_view_->GetImageBounds().bottom() -
479 icon_internal_padding + 1); 474 icon_internal_padding + 1);
480 gfx::Point icon_center(location_icon_view_->GetImageBounds().CenterPoint()); 475 gfx::Point icon_center(location_icon_view_->GetImageBounds().CenterPoint());
481 gfx::Point point(icon_center.x(), icon_bottom.y()); 476 gfx::Point point(icon_center.x(), icon_bottom.y());
482 ConvertPointToTarget(location_icon_view_, this, &point); 477 ConvertPointToTarget(location_icon_view_, this, &point);
483 return point; 478 return point;
484 } 479 }
485 480
486 views::View* LocationBarView::generated_credit_card_view() {
487 return generated_credit_card_view_;
488 }
489
490 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 481 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
491 int total_height = 482 int total_height =
492 use_preferred_size ? GetPreferredSize().height() : height(); 483 use_preferred_size ? GetPreferredSize().height() : height();
493 return std::max(total_height - (VerticalPadding() * 2), 0); 484 return std::max(total_height - (VerticalPadding() * 2), 0);
494 } 485 }
495 486
496 void LocationBarView::GetOmniboxPopupPositioningInfo( 487 void LocationBarView::GetOmniboxPopupPositioningInfo(
497 gfx::Point* top_left_screen_coord, 488 gfx::Point* top_left_screen_coord,
498 int* popup_width, 489 int* popup_width,
499 int* left_margin, 490 int* left_margin,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 horizontal_item_padding + location_icon_view_->GetMinimumSize().width(); 571 horizontal_item_padding + location_icon_view_->GetMinimumSize().width();
581 } 572 }
582 573
583 // Compute width of omnibox-trailing content. 574 // Compute width of omnibox-trailing content.
584 int trailing_width = horizontal_edge_thickness; 575 int trailing_width = horizontal_edge_thickness;
585 trailing_width += IncrementalMinimumWidth(star_view_) + 576 trailing_width += IncrementalMinimumWidth(star_view_) +
586 IncrementalMinimumWidth(translate_icon_view_) + 577 IncrementalMinimumWidth(translate_icon_view_) +
587 IncrementalMinimumWidth(open_pdf_in_reader_view_) + 578 IncrementalMinimumWidth(open_pdf_in_reader_view_) +
588 IncrementalMinimumWidth(manage_passwords_icon_view_) + 579 IncrementalMinimumWidth(manage_passwords_icon_view_) +
589 IncrementalMinimumWidth(zoom_view_) + 580 IncrementalMinimumWidth(zoom_view_) +
590 IncrementalMinimumWidth(generated_credit_card_view_) +
591 IncrementalMinimumWidth(mic_search_view_); 581 IncrementalMinimumWidth(mic_search_view_);
592 for (PageActionViews::const_iterator i(page_action_views_.begin()); 582 for (PageActionViews::const_iterator i(page_action_views_.begin());
593 i != page_action_views_.end(); ++i) 583 i != page_action_views_.end(); ++i)
594 trailing_width += IncrementalMinimumWidth((*i)); 584 trailing_width += IncrementalMinimumWidth((*i));
595 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); 585 for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
596 i != content_setting_views_.end(); ++i) 586 i != content_setting_views_.end(); ++i)
597 trailing_width += IncrementalMinimumWidth((*i)); 587 trailing_width += IncrementalMinimumWidth((*i));
598 588
599 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() + 589 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() +
600 2 * horizontal_item_padding - 590 2 * horizontal_item_padding -
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 697 }
708 for (ContentSettingViews::const_reverse_iterator i( 698 for (ContentSettingViews::const_reverse_iterator i(
709 content_setting_views_.rbegin()); i != content_setting_views_.rend(); 699 content_setting_views_.rbegin()); i != content_setting_views_.rend();
710 ++i) { 700 ++i) {
711 if ((*i)->visible()) { 701 if ((*i)->visible()) {
712 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height, 702 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height,
713 false, 0, horizontal_item_padding, 703 false, 0, horizontal_item_padding,
714 horizontal_item_padding, (*i)); 704 horizontal_item_padding, (*i));
715 } 705 }
716 } 706 }
717 if (generated_credit_card_view_->visible()) {
718 trailing_decorations.AddDecoration(vertical_padding, location_height,
719 generated_credit_card_view_);
720 }
721 if (mic_search_view_->visible()) { 707 if (mic_search_view_->visible()) {
722 trailing_decorations.AddDecoration(vertical_padding, location_height, 708 trailing_decorations.AddDecoration(vertical_padding, location_height,
723 mic_search_view_); 709 mic_search_view_);
724 } 710 }
725 // Because IMEs may eat the tab key, we don't show "press tab to search" while 711 // Because IMEs may eat the tab key, we don't show "press tab to search" while
726 // IME composition is in progress. 712 // IME composition is in progress.
727 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && 713 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() &&
728 !omnibox_view_->IsImeComposing()) { 714 !omnibox_view_->IsImeComposing()) {
729 trailing_decorations.AddDecoration( 715 trailing_decorations.AddDecoration(
730 vertical_padding, location_height, true, 0, horizontal_item_padding, 716 vertical_padding, location_height, true, 0, horizontal_item_padding,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 std::min(width, entry_width), location_bounds.height()); 815 std::min(width, entry_width), location_bounds.height());
830 } 816 }
831 omnibox_view_->SetBoundsRect(location_bounds); 817 omnibox_view_->SetBoundsRect(location_bounds);
832 } 818 }
833 819
834 void LocationBarView::Update(const WebContents* contents) { 820 void LocationBarView::Update(const WebContents* contents) {
835 mic_search_view_->SetVisible( 821 mic_search_view_->SetVisible(
836 !GetToolbarModel()->input_in_progress() && browser_ && 822 !GetToolbarModel()->input_in_progress() && browser_ &&
837 browser_->search_model()->voice_search_supported()); 823 browser_->search_model()->voice_search_supported());
838 RefreshContentSettingViews(); 824 RefreshContentSettingViews();
839 generated_credit_card_view_->Update();
840 RefreshZoomView(); 825 RefreshZoomView();
841 RefreshPageActionViews(); 826 RefreshPageActionViews();
842 RefreshTranslateIcon(); 827 RefreshTranslateIcon();
843 RefreshManagePasswordsIconView(); 828 RefreshManagePasswordsIconView();
844 content::WebContents* web_contents_for_sub_views = 829 content::WebContents* web_contents_for_sub_views =
845 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); 830 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents();
846 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); 831 open_pdf_in_reader_view_->Update(web_contents_for_sub_views);
847 832
848 if (star_view_) 833 if (star_view_)
849 UpdateBookmarkStarVisibility(); 834 UpdateBookmarkStarVisibility();
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 return extension_action_view_controller->ExecuteAction(grant_tab_permissions); 1160 return extension_action_view_controller->ExecuteAction(grant_tab_permissions);
1176 } 1161 }
1177 1162
1178 void LocationBarView::UpdateOpenPDFInReaderPrompt() { 1163 void LocationBarView::UpdateOpenPDFInReaderPrompt() {
1179 open_pdf_in_reader_view_->Update( 1164 open_pdf_in_reader_view_->Update(
1180 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents()); 1165 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents());
1181 Layout(); 1166 Layout();
1182 SchedulePaint(); 1167 SchedulePaint();
1183 } 1168 }
1184 1169
1185 void LocationBarView::UpdateGeneratedCreditCardView() {
1186 generated_credit_card_view_->Update();
1187 Layout();
1188 SchedulePaint();
1189 }
1190
1191 void LocationBarView::SaveStateToContents(WebContents* contents) { 1170 void LocationBarView::SaveStateToContents(WebContents* contents) {
1192 omnibox_view_->SaveStateToTab(contents); 1171 omnibox_view_->SaveStateToTab(contents);
1193 } 1172 }
1194 1173
1195 const OmniboxView* LocationBarView::GetOmniboxView() const { 1174 const OmniboxView* LocationBarView::GetOmniboxView() const {
1196 return omnibox_view_; 1175 return omnibox_view_;
1197 } 1176 }
1198 1177
1199 LocationBarTesting* LocationBarView::GetLocationBarForTesting() { 1178 LocationBarTesting* LocationBarView::GetLocationBarForTesting() {
1200 return this; 1179 return this;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 1409
1431 void LocationBarView::ModelChanged(const SearchModel::State& old_state, 1410 void LocationBarView::ModelChanged(const SearchModel::State& old_state,
1432 const SearchModel::State& new_state) { 1411 const SearchModel::State& new_state) {
1433 const bool visible = !GetToolbarModel()->input_in_progress() && 1412 const bool visible = !GetToolbarModel()->input_in_progress() &&
1434 new_state.voice_search_supported; 1413 new_state.voice_search_supported;
1435 if (mic_search_view_->visible() != visible) { 1414 if (mic_search_view_->visible() != visible) {
1436 mic_search_view_->SetVisible(visible); 1415 mic_search_view_->SetVisible(visible);
1437 Layout(); 1416 Layout();
1438 } 1417 }
1439 } 1418 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698