| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/theme_install_bubble_view.h" | 5 #include "chrome/browser/ui/views/theme_install_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "content/browser/tab_contents/tab_contents.h" | 8 #include "content/browser/tab_contents/tab_contents.h" |
| 9 #include "content/common/notification_service.h" | 9 #include "content/common/notification_service.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 this, | 63 this, |
| 64 NotificationType::EXTENSION_INSTALL_ERROR, | 64 NotificationType::EXTENSION_INSTALL_ERROR, |
| 65 NotificationService::AllSources()); | 65 NotificationService::AllSources()); |
| 66 | 66 |
| 67 // Don't let the bubble overlap the confirm dialog. | 67 // Don't let the bubble overlap the confirm dialog. |
| 68 registrar_.Add( | 68 registrar_.Add( |
| 69 this, | 69 this, |
| 70 NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, | 70 NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, |
| 71 NotificationService::AllSources()); | 71 NotificationService::AllSources()); |
| 72 | 72 |
| 73 gfx::Rect rc(0, 0, 0, 0); | 73 popup_ = views::Widget::CreateWidget(); |
| 74 popup_->SetOpacity(0xCC); |
| 74 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); | 75 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); |
| 75 params.transparent = true; | 76 params.transparent = true; |
| 76 params.accept_events = false; | 77 params.accept_events = false; |
| 77 popup_ = views::Widget::CreateWidget(params); | 78 params.parent = tab_contents->GetNativeView(); |
| 78 popup_->SetOpacity(0xCC); | 79 popup_->Init(params); |
| 79 popup_->Init(tab_contents->GetNativeView(), rc); | |
| 80 popup_->SetContentsView(this); | 80 popup_->SetContentsView(this); |
| 81 Reposition(); | 81 Reposition(); |
| 82 popup_->Show(); | 82 popup_->Show(); |
| 83 | 83 |
| 84 SchedulePaint(); | 84 SchedulePaint(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 ThemeInstallBubbleView::~ThemeInstallBubbleView() { | 87 ThemeInstallBubbleView::~ThemeInstallBubbleView() { |
| 88 num_loads_extant_ = 0; | 88 num_loads_extant_ = 0; |
| 89 } | 89 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 const NotificationDetails& details) { | 161 const NotificationDetails& details) { |
| 162 Close(); | 162 Close(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // static | 165 // static |
| 166 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { | 166 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { |
| 167 ++num_loads_extant_; | 167 ++num_loads_extant_; |
| 168 if (num_loads_extant_ < 2) | 168 if (num_loads_extant_ < 2) |
| 169 new ThemeInstallBubbleView(tab_contents); | 169 new ThemeInstallBubbleView(tab_contents); |
| 170 } | 170 } |
| OLD | NEW |