OLD | NEW |
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 generated_credit_card_view_ = new GeneratedCreditCardView(delegate_); | 380 generated_credit_card_view_ = new GeneratedCreditCardView(delegate_); |
381 AddChildView(generated_credit_card_view_); | 381 AddChildView(generated_credit_card_view_); |
382 | 382 |
383 zoom_view_ = new ZoomView(delegate_); | 383 zoom_view_ = new ZoomView(delegate_); |
384 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON); | 384 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON); |
385 AddChildView(zoom_view_); | 385 AddChildView(zoom_view_); |
386 | 386 |
387 open_pdf_in_reader_view_ = new OpenPDFInReaderView(); | 387 open_pdf_in_reader_view_ = new OpenPDFInReaderView(); |
388 AddChildView(open_pdf_in_reader_view_); | 388 AddChildView(open_pdf_in_reader_view_); |
389 | 389 |
390 manage_passwords_icon_view_ = new ManagePasswordsIconView(delegate_); | 390 manage_passwords_icon_view_ = |
| 391 new ManagePasswordsIconView(delegate_, command_updater()); |
391 manage_passwords_icon_view_->set_id(VIEW_ID_MANAGE_PASSWORDS_ICON_BUTTON); | 392 manage_passwords_icon_view_->set_id(VIEW_ID_MANAGE_PASSWORDS_ICON_BUTTON); |
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_); |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 } | 1221 } |
1221 | 1222 |
1222 bool LocationBarView::RefreshManagePasswordsIconView() { | 1223 bool LocationBarView::RefreshManagePasswordsIconView() { |
1223 DCHECK(manage_passwords_icon_view_); | 1224 DCHECK(manage_passwords_icon_view_); |
1224 WebContents* web_contents = GetWebContents(); | 1225 WebContents* web_contents = GetWebContents(); |
1225 if (!web_contents) | 1226 if (!web_contents) |
1226 return false; | 1227 return false; |
1227 const bool was_visible = manage_passwords_icon_view_->visible(); | 1228 const bool was_visible = manage_passwords_icon_view_->visible(); |
1228 manage_passwords_icon_view_->Update( | 1229 manage_passwords_icon_view_->Update( |
1229 ManagePasswordsBubbleUIController::FromWebContents(web_contents)); | 1230 ManagePasswordsBubbleUIController::FromWebContents(web_contents)); |
| 1231 command_updater()->UpdateCommandEnabled( |
| 1232 IDC_MANAGE_PASSWORDS_FOR_PAGE, manage_passwords_icon_view_->visible()); |
1230 return was_visible != manage_passwords_icon_view_->visible(); | 1233 return was_visible != manage_passwords_icon_view_->visible(); |
1231 } | 1234 } |
1232 | 1235 |
1233 void LocationBarView::ShowManagePasswordsBubbleIfNeeded() { | 1236 void LocationBarView::ShowManagePasswordsBubbleIfNeeded() { |
1234 DCHECK(manage_passwords_icon_view_); | 1237 DCHECK(manage_passwords_icon_view_); |
1235 WebContents* web_contents = GetWebContents(); | 1238 WebContents* web_contents = GetWebContents(); |
1236 if (!web_contents) | 1239 if (!web_contents) |
1237 return; | 1240 return; |
1238 manage_passwords_icon_view_->ShowBubbleIfNeeded( | 1241 manage_passwords_icon_view_->ShowBubbleIfNeeded( |
1239 ManagePasswordsBubbleUIController::FromWebContents(web_contents)); | 1242 ManagePasswordsBubbleUIController::FromWebContents(web_contents)); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1705 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
1703 const SearchModel::State& new_state) { | 1706 const SearchModel::State& new_state) { |
1704 const bool visible = !GetToolbarModel()->input_in_progress() && | 1707 const bool visible = !GetToolbarModel()->input_in_progress() && |
1705 new_state.voice_search_supported; | 1708 new_state.voice_search_supported; |
1706 if (mic_search_view_->visible() != visible) { | 1709 if (mic_search_view_->visible() != visible) { |
1707 mic_search_view_->SetVisible(visible); | 1710 mic_search_view_->SetVisible(visible); |
1708 Layout(); | 1711 Layout(); |
1709 } | 1712 } |
1710 } | 1713 } |
1711 | 1714 |
OLD | NEW |