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

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

Issue 10736028: Refactor browser window zoom handling and enable zoom icon on all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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 | Annotate | Revision Log
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/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 StartFadeAnimation(); 392 StartFadeAnimation();
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 zoom_view_->Update(); 402 ZoomBubbleView::CloseBubble();
403 RefreshZoomView();
403 RefreshPageActionViews(); 404 RefreshPageActionViews();
404 405
405 bool star_enabled = star_view_ && !model_->input_in_progress() && 406 bool star_enabled = star_view_ && !model_->input_in_progress() &&
406 edit_bookmarks_enabled_.GetValue(); 407 edit_bookmarks_enabled_.GetValue();
407 408
408 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); 409 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
409 if (star_view_) 410 if (star_view_)
410 star_view_->SetVisible(star_enabled); 411 star_view_->SetVisible(star_enabled);
411 412
412 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && 413 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() &&
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 if (star_view_) 501 if (star_view_)
501 star_view_->SetToggled(on); 502 star_view_->SetToggled(on);
502 if (action_box_button_view_) 503 if (action_box_button_view_)
503 action_box_button_view_->set_starred(on); 504 action_box_button_view_->set_starred(on);
504 } 505 }
505 506
506 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { 507 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
507 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); 508 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked);
508 } 509 }
509 510
510 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { 511 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) {
511 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); 512 RefreshZoomView();
512 }
513
514 void LocationBarView::SetZoomIconState(
515 ZoomController::ZoomIconState zoom_icon_state) {
516 zoom_view_->SetZoomIconState(zoom_icon_state);
517 513
518 Layout(); 514 Layout();
519 SchedulePaint(); 515 SchedulePaint();
516
517 // TODO(dbeam): don't show a bubble when the wrench menu is showing.
518 if (can_show_bubble && zoom_view_ && zoom_view_->visible())
519 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true);
520 } 520 }
521 521
522 void LocationBarView::ShowZoomBubble(int zoom_percent) { 522 void LocationBarView::RefreshZoomView() {
523 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); 523 TabContents* tab_contents = GetTabContents();
524 if (!zoom_view_ || !tab_contents)
525 return;
526
527 zoom_view_->Update(tab_contents->zoom_controller());
524 } 528 }
525 529
526 void LocationBarView::ShowChromeToMobileBubble() { 530 void LocationBarView::ShowChromeToMobileBubble() {
527 Browser* browser = GetBrowserFromDelegate(delegate_); 531 Browser* browser = GetBrowserFromDelegate(delegate_);
528 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); 532 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser);
529 } 533 }
530 534
531 gfx::Point LocationBarView::GetLocationEntryOrigin() const { 535 gfx::Point LocationBarView::GetLocationEntryOrigin() const {
532 gfx::Point origin(location_entry_view_->bounds().origin()); 536 gfx::Point origin(location_entry_view_->bounds().origin());
533 // If the UI layout is RTL, the coordinate system is not transformed and 537 // 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
1500 } 1504 }
1501 1505
1502 void LocationBarView::CleanupFadeAnimation() { 1506 void LocationBarView::CleanupFadeAnimation() {
1503 // Since we're no longer animating we don't need our layer. 1507 // Since we're no longer animating we don't need our layer.
1504 SetPaintToLayer(false); 1508 SetPaintToLayer(false);
1505 // Bubble labels don't need a transparent background anymore. 1509 // Bubble labels don't need a transparent background anymore.
1506 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1510 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1507 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1511 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1508 } 1512 }
1509 #endif // USE_AURA 1513 #endif // USE_AURA
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698