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

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

Issue 250353003: Password bubble: refactor ManagePasswordsIconView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 7 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 (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/command_line.h" 10 #include "base/command_line.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/translate/translate_service.h" 32 #include "chrome/browser/translate/translate_service.h"
33 #include "chrome/browser/translate/translate_tab_helper.h" 33 #include "chrome/browser/translate/translate_tab_helper.h"
34 #include "chrome/browser/ui/browser.h" 34 #include "chrome/browser/ui/browser.h"
35 #include "chrome/browser/ui/browser_finder.h" 35 #include "chrome/browser/ui/browser_finder.h"
36 #include "chrome/browser/ui/browser_instant_controller.h" 36 #include "chrome/browser/ui/browser_instant_controller.h"
37 #include "chrome/browser/ui/browser_window.h" 37 #include "chrome/browser/ui/browser_window.h"
38 #include "chrome/browser/ui/omnibox/location_bar_util.h" 38 #include "chrome/browser/ui/omnibox/location_bar_util.h"
39 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" 39 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
40 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" 40 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h"
41 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" 41 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h"
42 #include "chrome/browser/ui/passwords/manage_passwords_icon.h"
42 #include "chrome/browser/ui/tabs/tab_strip_model.h" 43 #include "chrome/browser/ui/tabs/tab_strip_model.h"
43 #include "chrome/browser/ui/toolbar/origin_chip_info.h" 44 #include "chrome/browser/ui/toolbar/origin_chip_info.h"
44 #include "chrome/browser/ui/view_ids.h" 45 #include "chrome/browser/ui/view_ids.h"
45 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h" 46 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h"
46 #include "chrome/browser/ui/views/browser_dialogs.h" 47 #include "chrome/browser/ui/views/browser_dialogs.h"
47 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" 48 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
48 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" 49 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
49 #include "chrome/browser/ui/views/location_bar/generated_credit_card_view.h" 50 #include "chrome/browser/ui/views/location_bar/generated_credit_card_view.h"
50 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" 51 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
51 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" 52 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 AddChildView(generated_credit_card_view_); 382 AddChildView(generated_credit_card_view_);
382 383
383 zoom_view_ = new ZoomView(delegate_); 384 zoom_view_ = new ZoomView(delegate_);
384 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON); 385 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON);
385 AddChildView(zoom_view_); 386 AddChildView(zoom_view_);
386 387
387 open_pdf_in_reader_view_ = new OpenPDFInReaderView(); 388 open_pdf_in_reader_view_ = new OpenPDFInReaderView();
388 AddChildView(open_pdf_in_reader_view_); 389 AddChildView(open_pdf_in_reader_view_);
389 390
390 manage_passwords_icon_view_ = new ManagePasswordsIconView(delegate_); 391 manage_passwords_icon_view_ = new ManagePasswordsIconView(delegate_);
391 manage_passwords_icon_view_->set_id(VIEW_ID_MANAGE_PASSWORDS_ICON_BUTTON); 392 manage_passwords_icon_view_->SetState(ManagePasswordsIcon::INACTIVE_STATE);
392 AddChildView(manage_passwords_icon_view_); 393 AddChildView(manage_passwords_icon_view_);
393 394
394 translate_icon_view_ = new TranslateIconView(command_updater()); 395 translate_icon_view_ = new TranslateIconView(command_updater());
395 translate_icon_view_->SetVisible(false); 396 translate_icon_view_->SetVisible(false);
396 AddChildView(translate_icon_view_); 397 AddChildView(translate_icon_view_);
397 398
398 star_view_ = new StarView(command_updater()); 399 star_view_ = new StarView(command_updater());
399 star_view_->SetVisible(false); 400 star_view_->SetVisible(false);
400 AddChildView(star_view_); 401 AddChildView(star_view_);
401 402
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 translate_icon_view_->SetVisible(enabled); 1221 translate_icon_view_->SetVisible(enabled);
1221 translate_icon_view_->SetToggled(language_state.IsPageTranslated()); 1222 translate_icon_view_->SetToggled(language_state.IsPageTranslated());
1222 } 1223 }
1223 1224
1224 bool LocationBarView::RefreshManagePasswordsIconView() { 1225 bool LocationBarView::RefreshManagePasswordsIconView() {
1225 DCHECK(manage_passwords_icon_view_); 1226 DCHECK(manage_passwords_icon_view_);
1226 WebContents* web_contents = GetWebContents(); 1227 WebContents* web_contents = GetWebContents();
1227 if (!web_contents) 1228 if (!web_contents)
1228 return false; 1229 return false;
1229 const bool was_visible = manage_passwords_icon_view_->visible(); 1230 const bool was_visible = manage_passwords_icon_view_->visible();
1230 manage_passwords_icon_view_->Update( 1231 ManagePasswordsBubbleUIController::FromWebContents(
1231 ManagePasswordsBubbleUIController::FromWebContents(web_contents)); 1232 web_contents)->UpdateIconAndBubbleState(manage_passwords_icon_view_);
1232 return was_visible != manage_passwords_icon_view_->visible(); 1233 return was_visible != manage_passwords_icon_view_->visible();
1233 } 1234 }
1234 1235
1235 void LocationBarView::ShowManagePasswordsBubbleIfNeeded() {
1236 DCHECK(manage_passwords_icon_view_);
1237 WebContents* web_contents = GetWebContents();
1238 if (!web_contents)
1239 return;
1240 manage_passwords_icon_view_->ShowBubbleIfNeeded(
1241 ManagePasswordsBubbleUIController::FromWebContents(web_contents));
1242 }
1243
1244 void LocationBarView::ShowFirstRunBubbleInternal() { 1236 void LocationBarView::ShowFirstRunBubbleInternal() {
1245 #if !defined(OS_CHROMEOS) 1237 #if !defined(OS_CHROMEOS)
1246 // First run bubble doesn't make sense for Chrome OS. 1238 // First run bubble doesn't make sense for Chrome OS.
1247 Browser* browser = GetBrowserFromDelegate(delegate_); 1239 Browser* browser = GetBrowserFromDelegate(delegate_);
1248 if (!browser) 1240 if (!browser)
1249 return; // Possible when browser is shutting down. 1241 return; // Possible when browser is shutting down.
1250 1242
1251 FirstRunBubble::ShowBubble(browser, GetLocationBarAnchor()); 1243 FirstRunBubble::ShowBubble(browser, GetLocationBarAnchor());
1252 #endif 1244 #endif
1253 } 1245 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 Layout(); 1315 Layout();
1324 SchedulePaint(); 1316 SchedulePaint();
1325 } 1317 }
1326 } 1318 }
1327 1319
1328 void LocationBarView::UpdateManagePasswordsIconAndBubble() { 1320 void LocationBarView::UpdateManagePasswordsIconAndBubble() {
1329 if (RefreshManagePasswordsIconView()) { 1321 if (RefreshManagePasswordsIconView()) {
1330 Layout(); 1322 Layout();
1331 SchedulePaint(); 1323 SchedulePaint();
1332 } 1324 }
1333 ShowManagePasswordsBubbleIfNeeded();
1334 } 1325 }
1335 1326
1336 void LocationBarView::UpdatePageActions() { 1327 void LocationBarView::UpdatePageActions() {
1337 size_t count_before = page_action_views_.size(); 1328 size_t count_before = page_action_views_.size();
1338 bool changed = RefreshPageActionViews(); 1329 bool changed = RefreshPageActionViews();
1339 if (page_action_views_.size() != count_before) { 1330 if (page_action_views_.size() != count_before) {
1340 content::NotificationService::current()->Notify( 1331 content::NotificationService::current()->Notify(
1341 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, 1332 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED,
1342 content::Source<LocationBar>(this), 1333 content::Source<LocationBar>(this),
1343 content::NotificationService::NoDetails()); 1334 content::NotificationService::NoDetails());
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 void LocationBarView::ModelChanged(const SearchModel::State& old_state, 1694 void LocationBarView::ModelChanged(const SearchModel::State& old_state,
1704 const SearchModel::State& new_state) { 1695 const SearchModel::State& new_state) {
1705 const bool visible = !GetToolbarModel()->input_in_progress() && 1696 const bool visible = !GetToolbarModel()->input_in_progress() &&
1706 new_state.voice_search_supported; 1697 new_state.voice_search_supported;
1707 if (mic_search_view_->visible() != visible) { 1698 if (mic_search_view_->visible() != visible) {
1708 mic_search_view_->SetVisible(visible); 1699 mic_search_view_->SetVisible(visible);
1709 Layout(); 1700 Layout();
1710 } 1701 }
1711 } 1702 }
1712 1703
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698