Chromium Code Reviews| 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(); |
| 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 // TODO(dbeam): don't show a bubble when the wrench menu is showing. | |
| 517 if (can_show_bubble && zoom_view_ && zoom_view_->visible()) | |
|
Peter Kasting
2012/08/16 04:04:48
Nit: You don't need to check |zoom_view_| unless t
Dan Beam
2012/08/16 06:52:29
Changed these to DCHECK()s instead as you're right
| |
| 518 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); | |
| 519 } | 519 } |
| 520 | 520 |
| 521 void LocationBarView::ShowZoomBubble(int zoom_percent) { | 521 void LocationBarView::RefreshZoomView() { |
| 522 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); | 522 TabContents* tab_contents = GetTabContents(); |
| 523 if (!zoom_view_ || !tab_contents) | |
|
Peter Kasting
2012/08/16 04:04:48
Nit: Shorter:
zoom_view_->Update(GetTabContents
Dan Beam
2012/08/16 06:52:29
I think khorimoto@ mentioned that the browser gets
| |
| 524 return; | |
| 525 | |
| 526 zoom_view_->Update(tab_contents->zoom_controller()); | |
| 523 } | 527 } |
| 524 | 528 |
| 525 void LocationBarView::ShowChromeToMobileBubble() { | 529 void LocationBarView::ShowChromeToMobileBubble() { |
| 526 Browser* browser = GetBrowserFromDelegate(delegate_); | 530 Browser* browser = GetBrowserFromDelegate(delegate_); |
| 527 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); | 531 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); |
| 528 } | 532 } |
| 529 | 533 |
| 530 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 534 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
| 531 gfx::Point origin(location_entry_view_->bounds().origin()); | 535 gfx::Point origin(location_entry_view_->bounds().origin()); |
| 532 // If the UI layout is RTL, the coordinate system is not transformed and | 536 // 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 } | 1503 } |
| 1500 | 1504 |
| 1501 void LocationBarView::CleanupFadeAnimation() { | 1505 void LocationBarView::CleanupFadeAnimation() { |
| 1502 // Since we're no longer animating we don't need our layer. | 1506 // Since we're no longer animating we don't need our layer. |
| 1503 SetPaintToLayer(false); | 1507 SetPaintToLayer(false); |
| 1504 // Bubble labels don't need a transparent background anymore. | 1508 // Bubble labels don't need a transparent background anymore. |
| 1505 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1509 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1506 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1510 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1507 } | 1511 } |
| 1508 #endif // USE_AURA | 1512 #endif // USE_AURA |
| OLD | NEW |