| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 StartFadeAnimation(); | 389 StartFadeAnimation(); |
| 390 } else { | 390 } else { |
| 391 // Cancel any pending animations; switch to the final state immediately. | 391 // Cancel any pending animations; switch to the final state immediately. |
| 392 StopFadeAnimation(); | 392 StopFadeAnimation(); |
| 393 } | 393 } |
| 394 #endif | 394 #endif |
| 395 } | 395 } |
| 396 | 396 |
| 397 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { | 397 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { |
| 398 RefreshContentSettingViews(); | 398 RefreshContentSettingViews(); |
| 399 zoom_view_->Update(); | 399 RefreshZoomView(); |
| 400 RefreshPageActionViews(); | 400 RefreshPageActionViews(); |
| 401 | 401 |
| 402 bool star_enabled = star_view_ && !model_->input_in_progress() && | 402 bool star_enabled = star_view_ && !model_->input_in_progress() && |
| 403 edit_bookmarks_enabled_.GetValue(); | 403 edit_bookmarks_enabled_.GetValue(); |
| 404 | 404 |
| 405 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); | 405 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); |
| 406 if (star_view_) | 406 if (star_view_) |
| 407 star_view_->SetVisible(star_enabled); | 407 star_view_->SetVisible(star_enabled); |
| 408 | 408 |
| 409 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && | 409 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 495 |
| 496 void LocationBarView::SetStarToggled(bool on) { | 496 void LocationBarView::SetStarToggled(bool on) { |
| 497 if (star_view_) | 497 if (star_view_) |
| 498 star_view_->SetToggled(on); | 498 star_view_->SetToggled(on); |
| 499 } | 499 } |
| 500 | 500 |
| 501 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { | 501 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
| 502 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); | 502 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { | 505 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) { |
| 506 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); | 506 RefreshZoomView(); |
| 507 } | |
| 508 | |
| 509 void LocationBarView::SetZoomIconState( | |
| 510 ZoomController::ZoomIconState zoom_icon_state) { | |
| 511 zoom_view_->SetZoomIconState(zoom_icon_state); | |
| 512 | 507 |
| 513 Layout(); | 508 Layout(); |
| 514 SchedulePaint(); | 509 SchedulePaint(); |
| 510 |
| 511 // TODO(dbeam): show the zoom bubble if appropriate. |
| 515 } | 512 } |
| 516 | 513 |
| 517 void LocationBarView::ShowZoomBubble(int zoom_percent) { | 514 void LocationBarView::RefreshZoomView() { |
| 518 ZoomBubbleView::ShowBubble(zoom_view_, zoom_percent, true); | 515 TabContents* tab_contents = GetTabContents(); |
| 516 if (!zoom_view_ || !tab_contents) |
| 517 return; |
| 518 |
| 519 zoom_view_->Update(tab_contents->zoom_controller()); |
| 519 } | 520 } |
| 520 | 521 |
| 521 void LocationBarView::ShowChromeToMobileBubble() { | 522 void LocationBarView::ShowChromeToMobileBubble() { |
| 522 Browser* browser = GetBrowserFromDelegate(delegate_); | 523 Browser* browser = GetBrowserFromDelegate(delegate_); |
| 523 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); | 524 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); |
| 524 } | 525 } |
| 525 | 526 |
| 526 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 527 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
| 527 gfx::Point origin(location_entry_view_->bounds().origin()); | 528 gfx::Point origin(location_entry_view_->bounds().origin()); |
| 528 // If the UI layout is RTL, the coordinate system is not transformed and | 529 // 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... |
| 1495 } | 1496 } |
| 1496 | 1497 |
| 1497 void LocationBarView::CleanupFadeAnimation() { | 1498 void LocationBarView::CleanupFadeAnimation() { |
| 1498 // Since we're no longer animating we don't need our layer. | 1499 // Since we're no longer animating we don't need our layer. |
| 1499 SetPaintToLayer(false); | 1500 SetPaintToLayer(false); |
| 1500 // Bubble labels don't need a transparent background anymore. | 1501 // Bubble labels don't need a transparent background anymore. |
| 1501 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1502 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1502 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1503 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1503 } | 1504 } |
| 1504 #endif // USE_AURA | 1505 #endif // USE_AURA |
| OLD | NEW |