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

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

Issue 11040055: Adds a FakeToolbarModel for use in testing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: git try Created 8 years, 2 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 (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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 SchedulePaint(); 451 SchedulePaint();
452 } 452 }
453 453
454 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { 454 void LocationBarView::Update(const WebContents* tab_for_state_restoring) {
455 RefreshContentSettingViews(); 455 RefreshContentSettingViews();
456 ZoomBubbleView::CloseBubble(); 456 ZoomBubbleView::CloseBubble();
457 RefreshZoomView(); 457 RefreshZoomView();
458 RefreshPageActionViews(); 458 RefreshPageActionViews();
459 web_intents_button_view_->Update(GetTabContents()); 459 web_intents_button_view_->Update(GetTabContents());
460 open_pdf_in_reader_view_->Update( 460 open_pdf_in_reader_view_->Update(
461 model_->input_in_progress() ? NULL : GetTabContents()); 461 model_->GetInputInProgress() ? NULL : GetTabContents());
462 462
463 bool star_enabled = star_view_ && !model_->input_in_progress() && 463 bool star_enabled = star_view_ && !model_->GetInputInProgress() &&
464 edit_bookmarks_enabled_.GetValue(); 464 edit_bookmarks_enabled_.GetValue();
465 465
466 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); 466 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
467 if (star_view_ && !extensions::switch_utils::IsActionBoxEnabled()) 467 if (star_view_ && !extensions::switch_utils::IsActionBoxEnabled())
468 star_view_->SetVisible(star_enabled); 468 star_view_->SetVisible(star_enabled);
469 469
470 ChromeToMobileService* chrome_to_mobile_service = 470 ChromeToMobileService* chrome_to_mobile_service =
471 ChromeToMobileServiceFactory::GetForProfile(profile_); 471 ChromeToMobileServiceFactory::GetForProfile(profile_);
472 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, 472 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE,
473 !model_->input_in_progress() && chrome_to_mobile_service && 473 !model_->GetInputInProgress() && chrome_to_mobile_service &&
474 chrome_to_mobile_service->HasMobiles()); 474 chrome_to_mobile_service->HasMobiles());
475 475
476 // Don't Update in app launcher mode so that the location entry does not show 476 // Don't Update in app launcher mode so that the location entry does not show
477 // a URL or security background. 477 // a URL or security background.
478 if (mode_ != APP_LAUNCHER) 478 if (mode_ != APP_LAUNCHER)
479 location_entry_->Update(tab_for_state_restoring); 479 location_entry_->Update(tab_for_state_restoring);
480 OnChanged(); 480 OnChanged();
481 } 481 }
482 482
483 void LocationBarView::UpdateContentSettingsIcons() { 483 void LocationBarView::UpdateContentSettingsIcons() {
(...skipping 30 matching lines...) Expand all
514 514
515 void LocationBarView::UpdateWebIntentsButton() { 515 void LocationBarView::UpdateWebIntentsButton() {
516 web_intents_button_view_->Update(GetTabContents()); 516 web_intents_button_view_->Update(GetTabContents());
517 517
518 Layout(); 518 Layout();
519 SchedulePaint(); 519 SchedulePaint();
520 } 520 }
521 521
522 void LocationBarView::UpdateOpenPDFInReaderPrompt() { 522 void LocationBarView::UpdateOpenPDFInReaderPrompt() {
523 open_pdf_in_reader_view_->Update( 523 open_pdf_in_reader_view_->Update(
524 model_->input_in_progress() ? NULL : GetTabContents()); 524 model_->GetInputInProgress() ? NULL : GetTabContents());
525 Layout(); 525 Layout();
526 SchedulePaint(); 526 SchedulePaint();
527 } 527 }
528 528
529 void LocationBarView::OnFocus() { 529 void LocationBarView::OnFocus() {
530 // Focus the view widget first which implements accessibility for 530 // Focus the view widget first which implements accessibility for
531 // Chrome OS. It is noop on Win. This should be removed once 531 // Chrome OS. It is noop on Win. This should be removed once
532 // Chrome OS migrates to aura, which uses Views' textfield that receives 532 // Chrome OS migrates to aura, which uses Views' textfield that receives
533 // focus. See crbug.com/106428. 533 // focus. See crbug.com/106428.
534 GetWidget()->NotifyAccessibilityEvent( 534 GetWidget()->NotifyAccessibilityEvent(
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 view->SetBounds( 1217 view->SetBounds(
1218 leading ? bounds->x() : (bounds->right() - view_size.width()), 1218 leading ? bounds->x() : (bounds->right() - view_size.width()),
1219 view->y(), view_size.width(), view->height()); 1219 view->y(), view_size.width(), view->height());
1220 bounds->set_width(bounds->width() - desired_width); 1220 bounds->set_width(bounds->width() - desired_width);
1221 } 1221 }
1222 } 1222 }
1223 1223
1224 void LocationBarView::RefreshContentSettingViews() { 1224 void LocationBarView::RefreshContentSettingViews() {
1225 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); 1225 for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
1226 i != content_setting_views_.end(); ++i) { 1226 i != content_setting_views_.end(); ++i) {
1227 (*i)->Update(model_->input_in_progress() ? NULL : GetTabContents()); 1227 (*i)->Update(model_->GetInputInProgress() ? NULL : GetTabContents());
1228 } 1228 }
1229 } 1229 }
1230 1230
1231 void LocationBarView::DeletePageActionViews() { 1231 void LocationBarView::DeletePageActionViews() {
1232 for (PageActionViews::const_iterator i(page_action_views_.begin()); 1232 for (PageActionViews::const_iterator i(page_action_views_.begin());
1233 i != page_action_views_.end(); ++i) 1233 i != page_action_views_.end(); ++i)
1234 RemoveChildView(*i); 1234 RemoveChildView(*i);
1235 STLDeleteElements(&page_action_views_); 1235 STLDeleteElements(&page_action_views_);
1236 } 1236 }
1237 1237
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 AddChildViewAt(page_action_views_[i], GetIndexOf(right_anchor)); 1281 AddChildViewAt(page_action_views_[i], GetIndexOf(right_anchor));
1282 } 1282 }
1283 } 1283 }
1284 1284
1285 if (!page_action_views_.empty() && contents) { 1285 if (!page_action_views_.empty() && contents) {
1286 Browser* browser = browser::FindBrowserWithWebContents(contents); 1286 Browser* browser = browser::FindBrowserWithWebContents(contents);
1287 GURL url = chrome::GetActiveWebContents(browser)->GetURL(); 1287 GURL url = chrome::GetActiveWebContents(browser)->GetURL();
1288 1288
1289 for (PageActionViews::const_iterator i(page_action_views_.begin()); 1289 for (PageActionViews::const_iterator i(page_action_views_.begin());
1290 i != page_action_views_.end(); ++i) { 1290 i != page_action_views_.end(); ++i) {
1291 (*i)->UpdateVisibility(model_->input_in_progress() ? NULL : contents, 1291 (*i)->UpdateVisibility(model_->GetInputInProgress() ? NULL : contents,
1292 url); 1292 url);
1293 1293
1294 // Check if the visibility of the action changed and notify if it did. 1294 // Check if the visibility of the action changed and notify if it did.
1295 ExtensionAction* action = (*i)->image_view()->page_action(); 1295 ExtensionAction* action = (*i)->image_view()->page_action();
1296 if (old_visibility.find(action) == old_visibility.end() || 1296 if (old_visibility.find(action) == old_visibility.end() ||
1297 old_visibility[action] != (*i)->visible()) { 1297 old_visibility[action] != (*i)->visible()) {
1298 content::NotificationService::current()->Notify( 1298 content::NotificationService::current()->Notify(
1299 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, 1299 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
1300 content::Source<ExtensionAction>(action), 1300 content::Source<ExtensionAction>(action),
1301 content::Details<WebContents>(contents)); 1301 content::Details<WebContents>(contents));
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 } 1687 }
1688 1688
1689 void LocationBarView::CleanupFadeAnimation() { 1689 void LocationBarView::CleanupFadeAnimation() {
1690 // Since we're no longer animating we don't need our layer. 1690 // Since we're no longer animating we don't need our layer.
1691 SetPaintToLayer(false); 1691 SetPaintToLayer(false);
1692 // Bubble labels don't need a transparent background anymore. 1692 // Bubble labels don't need a transparent background anymore.
1693 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1693 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1694 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1694 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1695 } 1695 }
1696 #endif // USE_AURA 1696 #endif // USE_AURA
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_model_impl.cc ('k') | chrome/browser/ui/views/location_bar/zoom_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698