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

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/command_line.h" 10 #include "base/command_line.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } else { 400 } else {
401 // Cancel any pending animations; switch to the final state immediately. 401 // Cancel any pending animations; switch to the final state immediately.
402 StopFadeAnimation(); 402 StopFadeAnimation();
403 } 403 }
404 #endif 404 #endif
405 } 405 }
406 406
407 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { 407 void LocationBarView::Update(const WebContents* tab_for_state_restoring) {
408 RefreshContentSettingViews(); 408 RefreshContentSettingViews();
409 ZoomBubbleView::CloseBubble(); 409 ZoomBubbleView::CloseBubble();
410 zoom_view_->Update(); 410 RefreshZoomView();
411 RefreshPageActionViews(); 411 RefreshPageActionViews();
412 412
413 bool star_enabled = star_view_ && !model_->input_in_progress() && 413 bool star_enabled = star_view_ && !model_->input_in_progress() &&
414 edit_bookmarks_enabled_.GetValue(); 414 edit_bookmarks_enabled_.GetValue();
415 415
416 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); 416 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
417 if (star_view_) 417 if (star_view_)
418 star_view_->SetVisible(star_enabled); 418 star_view_->SetVisible(star_enabled);
419 419
420 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && 420 bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() &&
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 if (star_view_) 512 if (star_view_)
513 star_view_->SetToggled(on); 513 star_view_->SetToggled(on);
514 if (action_box_button_view_) 514 if (action_box_button_view_)
515 action_box_button_view_->set_starred(on); 515 action_box_button_view_->set_starred(on);
516 } 516 }
517 517
518 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { 518 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
519 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); 519 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked);
520 } 520 }
521 521
522 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { 522 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) {
523 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); 523 DCHECK(zoom_view_);
524 } 524 RefreshZoomView();
525
526 void LocationBarView::SetZoomIconState(
527 ZoomController::ZoomIconState zoom_icon_state) {
528 zoom_view_->SetZoomIconState(zoom_icon_state);
529 525
530 Layout(); 526 Layout();
531 SchedulePaint(); 527 SchedulePaint();
528
529 // TODO(dbeam): don't show a bubble when the wrench menu is showing.
530 if (can_show_bubble && zoom_view_->visible())
531 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true);
532 } 532 }
533 533
534 void LocationBarView::ShowZoomBubble(int zoom_percent) { 534 void LocationBarView::RefreshZoomView() {
535 ZoomBubbleView::ShowBubble(zoom_view_, GetTabContents(), true); 535 DCHECK(zoom_view_);
536 TabContents* tab_contents = GetTabContents();
537 if (tab_contents)
538 zoom_view_->Update(tab_contents->zoom_controller());
536 } 539 }
537 540
538 void LocationBarView::ShowChromeToMobileBubble() { 541 void LocationBarView::ShowChromeToMobileBubble() {
539 Browser* browser = GetBrowserFromDelegate(delegate_); 542 Browser* browser = GetBrowserFromDelegate(delegate_);
540 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); 543 chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser);
541 } 544 }
542 545
543 gfx::Point LocationBarView::GetLocationEntryOrigin() const { 546 gfx::Point LocationBarView::GetLocationEntryOrigin() const {
544 gfx::Point origin(location_entry_view_->bounds().origin()); 547 gfx::Point origin(location_entry_view_->bounds().origin());
545 // If the UI layout is RTL, the coordinate system is not transformed and 548 // If the UI layout is RTL, the coordinate system is not transformed and
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 } 1514 }
1512 1515
1513 void LocationBarView::CleanupFadeAnimation() { 1516 void LocationBarView::CleanupFadeAnimation() {
1514 // Since we're no longer animating we don't need our layer. 1517 // Since we're no longer animating we don't need our layer.
1515 SetPaintToLayer(false); 1518 SetPaintToLayer(false);
1516 // Bubble labels don't need a transparent background anymore. 1519 // Bubble labels don't need a transparent background anymore.
1517 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1520 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1518 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1521 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1519 } 1522 }
1520 #endif // USE_AURA 1523 #endif // USE_AURA
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/browser/ui/views/location_bar/zoom_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698