| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 // Implementation of BlockedPopupContainer and its corresponding View | 5 // Implementation of BlockedPopupContainer and its corresponding View |
| 6 // class. The BlockedPopupContainer is the sort of Model class which owns the | 6 // class. The BlockedPopupContainer is the sort of Model class which owns the |
| 7 // blocked popups' TabContents (but like most Chromium interface code, it there | 7 // blocked popups' TabContents (but like most Chromium interface code, it there |
| 8 // isn't a strict Model/View separation), and BlockedPopupContainerView | 8 // isn't a strict Model/View separation), and BlockedPopupContainerView |
| 9 // presents the user interface controls, creates and manages the popup menu. | 9 // presents the user interface controls, creates and manages the popup menu. |
| 10 | 10 |
| 11 #include "chrome/browser/views/blocked_popup_container.h" | 11 #include "chrome/browser/views/blocked_popup_container.h" |
| 12 | 12 |
| 13 #include <math.h> | 13 #include <math.h> |
| 14 | 14 |
| 15 #include "app/gfx/chrome_canvas.h" | 15 #include "app/gfx/canvas.h" |
| 16 #include "app/gfx/path.h" | 16 #include "app/gfx/path.h" |
| 17 #include "app/l10n_util.h" | 17 #include "app/l10n_util.h" |
| 18 #include "app/resource_bundle.h" | 18 #include "app/resource_bundle.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 20 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 21 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
| 22 #include "chrome/browser/tab_contents/tab_contents.h" | 22 #include "chrome/browser/tab_contents/tab_contents.h" |
| 23 #include "chrome/common/notification_service.h" | 23 #include "chrome/common/notification_service.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/common/pref_service.h" | 25 #include "chrome/common/pref_service.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void BlockedPopupContainerView::UpdateLabel() { | 118 void BlockedPopupContainerView::UpdateLabel() { |
| 119 size_t blocked_popups = container_->GetBlockedPopupCount(); | 119 size_t blocked_popups = container_->GetBlockedPopupCount(); |
| 120 popup_count_label_->SetText((blocked_popups > 0) ? | 120 popup_count_label_->SetText((blocked_popups > 0) ? |
| 121 l10n_util::GetStringF(IDS_POPUPS_BLOCKED_COUNT, | 121 l10n_util::GetStringF(IDS_POPUPS_BLOCKED_COUNT, |
| 122 UintToWString(blocked_popups)) : | 122 UintToWString(blocked_popups)) : |
| 123 l10n_util::GetString(IDS_POPUPS_UNBLOCKED)); | 123 l10n_util::GetString(IDS_POPUPS_UNBLOCKED)); |
| 124 Layout(); | 124 Layout(); |
| 125 SchedulePaint(); | 125 SchedulePaint(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void BlockedPopupContainerView::Paint(ChromeCanvas* canvas) { | 128 void BlockedPopupContainerView::Paint(gfx::Canvas* canvas) { |
| 129 // Draw the standard background. | 129 // Draw the standard background. |
| 130 View::Paint(canvas); | 130 View::Paint(canvas); |
| 131 | 131 |
| 132 SkRect rect; | 132 SkRect rect; |
| 133 rect.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height())); | 133 rect.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height())); |
| 134 | 134 |
| 135 // Draw the border | 135 // Draw the border |
| 136 SkPaint border_paint; | 136 SkPaint border_paint; |
| 137 border_paint.setFlags(SkPaint::kAntiAlias_Flag); | 137 border_paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 138 border_paint.setStyle(SkPaint::kStroke_Style); | 138 border_paint.setStyle(SkPaint::kStroke_Style); |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } | 683 } |
| 684 | 684 |
| 685 // Erase the popup and update the UI. | 685 // Erase the popup and update the UI. |
| 686 UnblockedPopups::iterator next_popup = unblocked_popups_.erase(i); | 686 UnblockedPopups::iterator next_popup = unblocked_popups_.erase(i); |
| 687 if (blocked_popups_.empty() && unblocked_popups_.empty()) | 687 if (blocked_popups_.empty() && unblocked_popups_.empty()) |
| 688 HideSelf(); | 688 HideSelf(); |
| 689 else | 689 else |
| 690 container_view_->UpdateLabel(); | 690 container_view_->UpdateLabel(); |
| 691 return next_popup; | 691 return next_popup; |
| 692 } | 692 } |
| OLD | NEW |