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/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } else { | 393 } else { |
394 // Cancel any pending animations; switch to the final state immediately. | 394 // Cancel any pending animations; switch to the final state immediately. |
395 StopFadeAnimation(); | 395 StopFadeAnimation(); |
396 } | 396 } |
397 #endif | 397 #endif |
398 } | 398 } |
399 | 399 |
400 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { | 400 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { |
401 RefreshContentSettingViews(); | 401 RefreshContentSettingViews(); |
402 ZoomBubbleView::CloseBubble(); | 402 ZoomBubbleView::CloseBubble(); |
403 RefreshZoomView(); | 403 zoom_view_->Update(); |
404 RefreshPageActionViews(); | 404 RefreshPageActionViews(); |
405 | 405 |
406 bool star_enabled = star_view_ && !model_->input_in_progress() && | 406 bool star_enabled = star_view_ && !model_->input_in_progress() && |
407 edit_bookmarks_enabled_.GetValue(); | 407 edit_bookmarks_enabled_.GetValue(); |
408 | 408 |
409 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); | 409 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); |
410 if (star_view_) | 410 if (star_view_) |
411 star_view_->SetVisible(star_enabled); | 411 star_view_->SetVisible(star_enabled); |
412 | 412 |
413 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && | 413 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 if (star_view_) | 505 if (star_view_) |
506 star_view_->SetToggled(on); | 506 star_view_->SetToggled(on); |
507 if (action_box_button_view_) | 507 if (action_box_button_view_) |
508 action_box_button_view_->set_starred(on); | 508 action_box_button_view_->set_starred(on); |
509 } | 509 } |
510 | 510 |
511 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { | 511 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
512 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); | 512 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); |
513 } | 513 } |
514 | 514 |
515 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) { | 515 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { |
516 DCHECK(zoom_view_); | 516 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); |
517 RefreshZoomView(); | 517 } |
| 518 |
| 519 void LocationBarView::SetZoomIconState( |
| 520 ZoomController::ZoomIconState zoom_icon_state) { |
| 521 zoom_view_->SetZoomIconState(zoom_icon_state); |
518 | 522 |
519 Layout(); | 523 Layout(); |
520 SchedulePaint(); | 524 SchedulePaint(); |
521 | |
522 // TODO(dbeam): don't show a bubble when the wrench menu is showing. | |
523 if (can_show_bubble && zoom_view_->visible()) | |
524 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); | |
525 } | 525 } |
526 | 526 |
527 void LocationBarView::RefreshZoomView() { | 527 void LocationBarView::ShowZoomBubble(int zoom_percent) { |
528 DCHECK(zoom_view_); | 528 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); |
529 TabContents* tab_contents = GetTabContents(); | |
530 if (tab_contents) | |
531 zoom_view_->Update(tab_contents->zoom_controller()); | |
532 } | 529 } |
533 | 530 |
534 void LocationBarView::ShowChromeToMobileBubble() { | 531 void LocationBarView::ShowChromeToMobileBubble() { |
535 Browser* browser = GetBrowserFromDelegate(delegate_); | 532 Browser* browser = GetBrowserFromDelegate(delegate_); |
536 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); | 533 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); |
537 } | 534 } |
538 | 535 |
539 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 536 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
540 gfx::Point origin(location_entry_view_->bounds().origin()); | 537 gfx::Point origin(location_entry_view_->bounds().origin()); |
541 // If the UI layout is RTL, the coordinate system is not transformed and | 538 // If the UI layout is RTL, the coordinate system is not transformed and |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 } | 1505 } |
1509 | 1506 |
1510 void LocationBarView::CleanupFadeAnimation() { | 1507 void LocationBarView::CleanupFadeAnimation() { |
1511 // Since we're no longer animating we don't need our layer. | 1508 // Since we're no longer animating we don't need our layer. |
1512 SetPaintToLayer(false); | 1509 SetPaintToLayer(false); |
1513 // Bubble labels don't need a transparent background anymore. | 1510 // Bubble labels don't need a transparent background anymore. |
1514 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1511 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1515 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1512 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1516 } | 1513 } |
1517 #endif // USE_AURA | 1514 #endif // USE_AURA |
OLD | NEW |