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

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

Issue 327007: Revert 29861 since this fail on the interactive... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/location_bar_view.h" 5 #include "chrome/browser/views/location_bar_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return template_url->AdjustedShortNameForLocaleDirection(); 85 return template_url->AdjustedShortNameForLocaleDirection();
86 return std::wstring(); 86 return std::wstring();
87 } 87 }
88 88
89 89
90 // PageActionWithBadgeView ---------------------------------------------------- 90 // PageActionWithBadgeView ----------------------------------------------------
91 91
92 // A container for the PageActionImageView plus its badge. 92 // A container for the PageActionImageView plus its badge.
93 class LocationBarView::PageActionWithBadgeView : public views::View { 93 class LocationBarView::PageActionWithBadgeView : public views::View {
94 public: 94 public:
95 explicit PageActionWithBadgeView(PageActionImageView* image_view); 95 PageActionWithBadgeView(PageActionImageView* image_view);
96 96
97 PageActionImageView* image_view() { return image_view_; } 97 PageActionImageView* image_view() { return image_view_; }
98 98
99 virtual gfx::Size GetPreferredSize() { 99 virtual gfx::Size GetPreferredSize() {
100 return gfx::Size(kPageActionButtonSize, kPageActionButtonSize); 100 return gfx::Size(kPageActionButtonSize, kPageActionButtonSize);
101 } 101 }
102 102
103 void UpdateVisibility(TabContents* contents, const GURL& url); 103 void UpdateVisibility(TabContents* contents, const GURL& url);
104 104
105 private: 105 private:
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 page_action_views_.end()); 691 page_action_views_.end());
692 page_action_views_.clear(); 692 page_action_views_.clear();
693 } 693 }
694 } 694 }
695 695
696 void LocationBarView::RefreshPageActionViews() { 696 void LocationBarView::RefreshPageActionViews() {
697 std::vector<ExtensionAction*> page_actions; 697 std::vector<ExtensionAction*> page_actions;
698 if (profile_->GetExtensionsService()) 698 if (profile_->GetExtensionsService())
699 page_actions = profile_->GetExtensionsService()->GetPageActions(); 699 page_actions = profile_->GetExtensionsService()->GetPageActions();
700 700
701 // Page actions can be created without an icon, so make sure we count only
702 // those that have been given an icon.
703 for (size_t i = 0; i < page_actions.size();) {
704 if (page_actions[i]->icon_paths().empty())
705 page_actions.erase(page_actions.begin() + i);
706 else
707 ++i;
708 }
709
710 // On startup we sometimes haven't loaded any extensions. This makes sure 701 // On startup we sometimes haven't loaded any extensions. This makes sure
711 // we catch up when the extensions (and any page actions) load. 702 // we catch up when the extensions (and any page actions) load.
712 if (page_actions.size() != page_action_views_.size()) { 703 if (page_actions.size() != page_action_views_.size()) {
713 DeletePageActionViews(); // Delete the old views (if any). 704 DeletePageActionViews(); // Delete the old views (if any).
714 705
715 page_action_views_.resize(page_actions.size()); 706 page_action_views_.resize(page_actions.size());
716 707
717 for (size_t i = 0; i < page_actions.size(); ++i) { 708 for (size_t i = 0; i < page_actions.size(); ++i) {
718 page_action_views_[i] = new PageActionWithBadgeView( 709 page_action_views_[i] = new PageActionWithBadgeView(
719 new PageActionImageView(this, profile_, 710 new PageActionImageView(this, profile_,
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 } 1398 }
1408 1399
1409 int LocationBarView::PageActionVisibleCount() { 1400 int LocationBarView::PageActionVisibleCount() {
1410 int result = 0; 1401 int result = 0;
1411 for (size_t i = 0; i < page_action_views_.size(); i++) { 1402 for (size_t i = 0; i < page_action_views_.size(); i++) {
1412 if (page_action_views_[i]->IsVisible()) 1403 if (page_action_views_[i]->IsVisible())
1413 ++result; 1404 ++result;
1414 } 1405 }
1415 return result; 1406 return result;
1416 } 1407 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/location_bar_view_gtk.cc ('k') | chrome/test/data/extensions/browsertest/crash_25562/background.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698