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

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

Issue 87853004: Refactoring Manage Passwords Bubble Code to exclude TabSpecificContentSettings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movingclasses
Patch Set: Android fix Created 7 years 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 (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 15 matching lines...) Expand all
26 #include "chrome/browser/search_engines/template_url_service.h" 26 #include "chrome/browser/search_engines/template_url_service.h"
27 #include "chrome/browser/search_engines/template_url_service_factory.h" 27 #include "chrome/browser/search_engines/template_url_service_factory.h"
28 #include "chrome/browser/translate/translate_tab_helper.h" 28 #include "chrome/browser/translate/translate_tab_helper.h"
29 #include "chrome/browser/ui/browser.h" 29 #include "chrome/browser/ui/browser.h"
30 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
31 #include "chrome/browser/ui/browser_instant_controller.h" 31 #include "chrome/browser/ui/browser_instant_controller.h"
32 #include "chrome/browser/ui/browser_window.h" 32 #include "chrome/browser/ui/browser_window.h"
33 #include "chrome/browser/ui/omnibox/location_bar_util.h" 33 #include "chrome/browser/ui/omnibox/location_bar_util.h"
34 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" 34 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
35 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" 35 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h"
36 #include "chrome/browser/ui/passwords/manage_passwords_icon_controller.h" 36 #include "chrome/browser/ui/passwords/manage_passwords_bubble_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/bookmarks/bookmark_prompt_view.h" 39 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h"
40 #include "chrome/browser/ui/views/browser_dialogs.h" 40 #include "chrome/browser/ui/views/browser_dialogs.h"
41 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" 41 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
42 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" 42 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
43 #include "chrome/browser/ui/views/location_bar/generated_credit_card_view.h" 43 #include "chrome/browser/ui/views/location_bar/generated_credit_card_view.h"
44 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" 44 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
45 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" 45 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
46 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 46 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 return was_visible != zoom_view_->visible(); 1387 return was_visible != zoom_view_->visible();
1388 } 1388 }
1389 1389
1390 bool LocationBarView::RefreshManagePasswordsIconView() { 1390 bool LocationBarView::RefreshManagePasswordsIconView() {
1391 DCHECK(manage_passwords_icon_view_); 1391 DCHECK(manage_passwords_icon_view_);
1392 WebContents* web_contents = GetWebContents(); 1392 WebContents* web_contents = GetWebContents();
1393 if (!web_contents) 1393 if (!web_contents)
1394 return false; 1394 return false;
1395 const bool was_visible = manage_passwords_icon_view_->visible(); 1395 const bool was_visible = manage_passwords_icon_view_->visible();
1396 manage_passwords_icon_view_->Update( 1396 manage_passwords_icon_view_->Update(
1397 ManagePasswordsIconController::FromWebContents(web_contents)); 1397 ManagePasswordsBubbleUIController::FromWebContents(web_contents));
1398 return was_visible != manage_passwords_icon_view_->visible(); 1398 return was_visible != manage_passwords_icon_view_->visible();
1399 } 1399 }
1400 1400
1401 void LocationBarView::RefreshTranslateIcon() { 1401 void LocationBarView::RefreshTranslateIcon() {
1402 WebContents* web_contents = GetWebContents(); 1402 WebContents* web_contents = GetWebContents();
1403 if (!web_contents || !CommandLine::ForCurrentProcess()->HasSwitch( 1403 if (!web_contents || !CommandLine::ForCurrentProcess()->HasSwitch(
1404 switches::kEnableTranslateNewUX)) 1404 switches::kEnableTranslateNewUX))
1405 return; 1405 return;
1406 LanguageState& language_state = TranslateTabHelper::FromWebContents( 1406 LanguageState& language_state = TranslateTabHelper::FromWebContents(
1407 web_contents)->language_state(); 1407 web_contents)->language_state();
1408 bool enabled = language_state.translate_enabled(); 1408 bool enabled = language_state.translate_enabled();
1409 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); 1409 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled);
1410 translate_icon_view_->SetVisible(enabled); 1410 translate_icon_view_->SetVisible(enabled);
1411 translate_icon_view_->SetToggled(language_state.IsPageTranslated()); 1411 translate_icon_view_->SetToggled(language_state.IsPageTranslated());
1412 } 1412 }
1413 1413
1414 void LocationBarView::ShowManagePasswordsBubbleIfNeeded() { 1414 void LocationBarView::ShowManagePasswordsBubbleIfNeeded() {
1415 DCHECK(manage_passwords_icon_view_); 1415 DCHECK(manage_passwords_icon_view_);
1416 WebContents* web_contents = GetWebContents(); 1416 WebContents* web_contents = GetWebContents();
1417 if (!web_contents) 1417 if (!web_contents)
1418 return; 1418 return;
1419 manage_passwords_icon_view_->ShowBubbleIfNeeded( 1419 manage_passwords_icon_view_->ShowBubbleIfNeeded(
1420 ManagePasswordsIconController::FromWebContents(web_contents)); 1420 ManagePasswordsBubbleUIController::FromWebContents(web_contents));
1421 } 1421 }
1422 1422
1423 bool LocationBarView::HasValidSuggestText() const { 1423 bool LocationBarView::HasValidSuggestText() const {
1424 return suggested_text_view_->visible() && 1424 return suggested_text_view_->visible() &&
1425 !suggested_text_view_->size().IsEmpty(); 1425 !suggested_text_view_->size().IsEmpty();
1426 } 1426 }
1427 1427
1428 void LocationBarView::ShowFirstRunBubbleInternal() { 1428 void LocationBarView::ShowFirstRunBubbleInternal() {
1429 #if !defined(OS_CHROMEOS) 1429 #if !defined(OS_CHROMEOS)
1430 // First run bubble doesn't make sense for Chrome OS. 1430 // First run bubble doesn't make sense for Chrome OS.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 bounds.Inset(-(horizontal_padding + 1) / 2, 0); 1465 bounds.Inset(-(horizontal_padding + 1) / 2, 0);
1466 location_bar_util::PaintExtensionActionBackground( 1466 location_bar_util::PaintExtensionActionBackground(
1467 *(*page_action_view)->image_view()->page_action(), 1467 *(*page_action_view)->image_view()->page_action(),
1468 tab_id, canvas, bounds, text_color, background_color); 1468 tab_id, canvas, bounds, text_color, background_color);
1469 } 1469 }
1470 } 1470 }
1471 1471
1472 void LocationBarView::AccessibilitySetValue(const string16& new_value) { 1472 void LocationBarView::AccessibilitySetValue(const string16& new_value) {
1473 omnibox_view_->SetUserText(new_value, new_value, true); 1473 omnibox_view_->SetUserText(new_value, new_value, true);
1474 } 1474 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698