| OLD | NEW |
| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 void LocationBarView::PageActionWithBadgeView::Layout() { | 121 void LocationBarView::PageActionWithBadgeView::Layout() { |
| 122 image_view_->SetBounds(0, 0, width(), height()); | 122 image_view_->SetBounds(0, 0, width(), height()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void LocationBarView::PageActionWithBadgeView::PaintChildren( | 125 void LocationBarView::PageActionWithBadgeView::PaintChildren( |
| 126 gfx::Canvas* canvas) { | 126 gfx::Canvas* canvas) { |
| 127 View::PaintChildren(canvas); | 127 View::PaintChildren(canvas); |
| 128 const ExtensionActionState* state = image_view_->GetPageActionState(); | 128 const ExtensionActionState* state = image_view_->GetPageActionState(); |
| 129 if (state) | 129 if (state) { |
| 130 state->PaintBadge(canvas, gfx::Rect(width(), height())); | 130 ExtensionActionState::PaintBadge(canvas, gfx::Rect(width(), height()), |
| 131 state->badge_text(), |
| 132 state->badge_text_color(), |
| 133 state->badge_background_color()); |
| 134 } |
| 131 } | 135 } |
| 132 | 136 |
| 133 void LocationBarView::PageActionWithBadgeView::UpdateVisibility( | 137 void LocationBarView::PageActionWithBadgeView::UpdateVisibility( |
| 134 TabContents* contents, const GURL& url) { | 138 TabContents* contents, const GURL& url) { |
| 135 image_view_->UpdateVisibility(contents, url); | 139 image_view_->UpdateVisibility(contents, url); |
| 136 SetVisible(image_view_->IsVisible()); | 140 SetVisible(image_view_->IsVisible()); |
| 137 } | 141 } |
| 138 | 142 |
| 139 | 143 |
| 140 // LocationBarView ----------------------------------------------------------- | 144 // LocationBarView ----------------------------------------------------------- |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 | 1235 |
| 1232 void LocationBarView::PageActionImageView::Paint(gfx::Canvas* canvas) { | 1236 void LocationBarView::PageActionImageView::Paint(gfx::Canvas* canvas) { |
| 1233 LocationBarImageView::Paint(canvas); | 1237 LocationBarImageView::Paint(canvas); |
| 1234 | 1238 |
| 1235 TabContents* contents = owner_->delegate_->GetTabContents(); | 1239 TabContents* contents = owner_->delegate_->GetTabContents(); |
| 1236 if (!contents) | 1240 if (!contents) |
| 1237 return; | 1241 return; |
| 1238 | 1242 |
| 1239 const ExtensionActionState* state = | 1243 const ExtensionActionState* state = |
| 1240 contents->GetPageActionState(page_action_); | 1244 contents->GetPageActionState(page_action_); |
| 1241 if (state) | 1245 if (state) { |
| 1242 state->PaintBadge(canvas, gfx::Rect(width(), height())); | 1246 ExtensionActionState::PaintBadge(canvas, gfx::Rect(width(), height()), |
| 1247 state->badge_text(), |
| 1248 state->badge_text_color(), |
| 1249 state->badge_background_color()); |
| 1250 } |
| 1243 } | 1251 } |
| 1244 | 1252 |
| 1245 // PageActionImageView---------------------------------------------------------- | 1253 // PageActionImageView---------------------------------------------------------- |
| 1246 | 1254 |
| 1247 LocationBarView::PageActionImageView::PageActionImageView( | 1255 LocationBarView::PageActionImageView::PageActionImageView( |
| 1248 LocationBarView* owner, | 1256 LocationBarView* owner, |
| 1249 Profile* profile, | 1257 Profile* profile, |
| 1250 const ExtensionAction* page_action, | 1258 const ExtensionAction* page_action, |
| 1251 const BubblePositioner* bubble_positioner) | 1259 const BubblePositioner* bubble_positioner) |
| 1252 : LocationBarImageView(bubble_positioner), | 1260 : LocationBarImageView(bubble_positioner), |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 } | 1406 } |
| 1399 | 1407 |
| 1400 int LocationBarView::PageActionVisibleCount() { | 1408 int LocationBarView::PageActionVisibleCount() { |
| 1401 int result = 0; | 1409 int result = 0; |
| 1402 for (size_t i = 0; i < page_action_views_.size(); i++) { | 1410 for (size_t i = 0; i < page_action_views_.size(); i++) { |
| 1403 if (page_action_views_[i]->IsVisible()) | 1411 if (page_action_views_[i]->IsVisible()) |
| 1404 ++result; | 1412 ++result; |
| 1405 } | 1413 } |
| 1406 return result; | 1414 return result; |
| 1407 } | 1415 } |
| OLD | NEW |