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

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

Powered by Google App Engine
This is Rietveld 408576698