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

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: . 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 RefreshZoomView();
402 RefreshPageActionViews(); 402 RefreshPageActionViews();
403 403
404 bool star_enabled = star_view_ && !model_->input_in_progress() && 404 bool star_enabled = star_view_ && !model_->input_in_progress() &&
405 edit_bookmarks_enabled_.GetValue(); 405 edit_bookmarks_enabled_.GetValue();
406 406
407 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); 407 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
408 if (star_view_) 408 if (star_view_)
409 star_view_->SetVisible(star_enabled); 409 star_view_->SetVisible(star_enabled);
410 410
411 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && 411 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() &&
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 if (star_view_) 499 if (star_view_)
500 star_view_->SetToggled(on); 500 star_view_->SetToggled(on);
501 if (action_box_button_view_) 501 if (action_box_button_view_)
502 action_box_button_view_->set_starred(on); 502 action_box_button_view_->set_starred(on);
503 } 503 }
504 504
505 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { 505 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
506 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); 506 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked);
507 } 507 }
508 508
509 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { 509 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) {
510 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); 510 RefreshZoomView();
511 }
512
513 void LocationBarView::SetZoomIconState(
514 ZoomController::ZoomIconState zoom_icon_state) {
515 zoom_view_->SetZoomIconState(zoom_icon_state);
516 511
517 Layout(); 512 Layout();
518 SchedulePaint(); 513 SchedulePaint();
514
515 if (can_show_bubble)
516 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true);
519 } 517 }
520 518
521 void LocationBarView::ShowZoomBubble(int zoom_percent) { 519 void LocationBarView::RefreshZoomView() {
522 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); 520 TabContents* tab_contents = GetTabContents();
521 if (!zoom_view_ || !tab_contents)
522 return;
523
524 zoom_view_->Update(tab_contents->zoom_controller());
523 } 525 }
524 526
525 void LocationBarView::ShowChromeToMobileBubble() { 527 void LocationBarView::ShowChromeToMobileBubble() {
526 Browser* browser = GetBrowserFromDelegate(delegate_); 528 Browser* browser = GetBrowserFromDelegate(delegate_);
527 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); 529 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser);
528 } 530 }
529 531
530 gfx::Point LocationBarView::GetLocationEntryOrigin() const { 532 gfx::Point LocationBarView::GetLocationEntryOrigin() const {
531 gfx::Point origin(location_entry_view_->bounds().origin()); 533 gfx::Point origin(location_entry_view_->bounds().origin());
532 // If the UI layout is RTL, the coordinate system is not transformed and 534 // 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
1499 } 1501 }
1500 1502
1501 void LocationBarView::CleanupFadeAnimation() { 1503 void LocationBarView::CleanupFadeAnimation() {
1502 // Since we're no longer animating we don't need our layer. 1504 // Since we're no longer animating we don't need our layer.
1503 SetPaintToLayer(false); 1505 SetPaintToLayer(false);
1504 // Bubble labels don't need a transparent background anymore. 1506 // Bubble labels don't need a transparent background anymore.
1505 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1507 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1506 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1508 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1507 } 1509 }
1508 #endif // USE_AURA 1510 #endif // USE_AURA
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698