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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 StartFadeAnimation(); | 391 StartFadeAnimation(); |
392 } else { | 392 } else { |
393 // Cancel any pending animations; switch to the final state immediately. | 393 // Cancel any pending animations; switch to the final state immediately. |
394 StopFadeAnimation(); | 394 StopFadeAnimation(); |
395 } | 395 } |
396 #endif | 396 #endif |
397 } | 397 } |
398 | 398 |
399 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { | 399 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { |
400 RefreshContentSettingViews(); | 400 RefreshContentSettingViews(); |
401 zoom_view_->Update(); | 401 ZoomBubbleView::CloseBubble(); |
Dan Beam
2012/08/15 23:26:01
NOTE: yes, this is just a patch in of https://chro
| |
402 RefreshZoomView(); | |
402 RefreshPageActionViews(); | 403 RefreshPageActionViews(); |
403 | 404 |
404 bool star_enabled = star_view_ && !model_->input_in_progress() && | 405 bool star_enabled = star_view_ && !model_->input_in_progress() && |
405 edit_bookmarks_enabled_.GetValue(); | 406 edit_bookmarks_enabled_.GetValue(); |
406 | 407 |
407 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); | 408 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); |
408 if (star_view_) | 409 if (star_view_) |
409 star_view_->SetVisible(star_enabled); | 410 star_view_->SetVisible(star_enabled); |
410 | 411 |
411 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && | 412 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 if (star_view_) | 500 if (star_view_) |
500 star_view_->SetToggled(on); | 501 star_view_->SetToggled(on); |
501 if (action_box_button_view_) | 502 if (action_box_button_view_) |
502 action_box_button_view_->set_starred(on); | 503 action_box_button_view_->set_starred(on); |
503 } | 504 } |
504 | 505 |
505 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { | 506 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
506 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); | 507 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); |
507 } | 508 } |
508 | 509 |
509 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { | 510 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) { |
510 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); | 511 RefreshZoomView(); |
511 } | |
512 | |
513 void LocationBarView::SetZoomIconState( | |
514 ZoomController::ZoomIconState zoom_icon_state) { | |
515 zoom_view_->SetZoomIconState(zoom_icon_state); | |
516 | 512 |
517 Layout(); | 513 Layout(); |
518 SchedulePaint(); | 514 SchedulePaint(); |
515 | |
516 if (can_show_bubble && zoom_view_ && zoom_view_->visible()) | |
517 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); | |
519 } | 518 } |
520 | 519 |
521 void LocationBarView::ShowZoomBubble(int zoom_percent) { | 520 void LocationBarView::RefreshZoomView() { |
522 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); | 521 TabContents* tab_contents = GetTabContents(); |
522 if (!zoom_view_ || !tab_contents) | |
523 return; | |
524 | |
525 zoom_view_->Update(tab_contents->zoom_controller()); | |
523 } | 526 } |
524 | 527 |
525 void LocationBarView::ShowChromeToMobileBubble() { | 528 void LocationBarView::ShowChromeToMobileBubble() { |
526 Browser* browser = GetBrowserFromDelegate(delegate_); | 529 Browser* browser = GetBrowserFromDelegate(delegate_); |
527 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); | 530 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); |
528 } | 531 } |
529 | 532 |
530 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 533 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
531 gfx::Point origin(location_entry_view_->bounds().origin()); | 534 gfx::Point origin(location_entry_view_->bounds().origin()); |
532 // If the UI layout is RTL, the coordinate system is not transformed and | 535 // 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... | |
1499 } | 1502 } |
1500 | 1503 |
1501 void LocationBarView::CleanupFadeAnimation() { | 1504 void LocationBarView::CleanupFadeAnimation() { |
1502 // Since we're no longer animating we don't need our layer. | 1505 // Since we're no longer animating we don't need our layer. |
1503 SetPaintToLayer(false); | 1506 SetPaintToLayer(false); |
1504 // Bubble labels don't need a transparent background anymore. | 1507 // Bubble labels don't need a transparent background anymore. |
1505 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1508 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1506 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1509 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
1507 } | 1510 } |
1508 #endif // USE_AURA | 1511 #endif // USE_AURA |
OLD | NEW |