| OLD | NEW |
| 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/extensions/extension_error_ui_default.h" | 5 #include "chrome/browser/extensions/extension_error_ui_default.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/chrome_pages.h" | 13 #include "chrome/browser/ui/chrome_pages.h" |
| 14 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" | 14 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 ExtensionErrorUIDefault::ExtensionErrorUIDefault( | 18 ExtensionErrorUIDefault::ExtensionErrorUIDefault( |
| 19 ExtensionErrorUI::Delegate* delegate) | 19 ExtensionErrorUI::Delegate* delegate) |
| 20 : ExtensionErrorUI(delegate), | 20 : ExtensionErrorUI(delegate), |
| 21 profile_(Profile::FromBrowserContext(delegate->GetContext())), | 21 profile_(Profile::FromBrowserContext(delegate->GetContext())), |
| 22 browser_(NULL), | 22 browser_(NULL), |
| 23 global_error_(new ExtensionGlobalError(this)) { | 23 global_error_(new ExtensionGlobalError(this)) { |
| 24 } | 24 } |
| 25 | 25 |
| 26 ExtensionErrorUIDefault::~ExtensionErrorUIDefault() { | 26 ExtensionErrorUIDefault::~ExtensionErrorUIDefault() { |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool ExtensionErrorUIDefault::ShowErrorInBubbleView() { | 29 bool ExtensionErrorUIDefault::ShowErrorInBubbleView() { |
| 30 Browser* browser = | 30 Browser* browser = chrome::FindLastActiveWithProfile(profile_); |
| 31 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); | |
| 32 if (!browser) | 31 if (!browser) |
| 33 return false; | 32 return false; |
| 34 | 33 |
| 35 browser_ = browser; | 34 browser_ = browser; |
| 36 global_error_->ShowBubbleView(browser); | 35 global_error_->ShowBubbleView(browser); |
| 37 return true; | 36 return true; |
| 38 } | 37 } |
| 39 | 38 |
| 40 void ExtensionErrorUIDefault::ShowExtensions() { | 39 void ExtensionErrorUIDefault::ShowExtensions() { |
| 41 DCHECK(browser_); | 40 DCHECK(browser_); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 error_ui_->BubbleViewCancelButtonPressed(); | 108 error_ui_->BubbleViewCancelButtonPressed(); |
| 110 } | 109 } |
| 111 | 110 |
| 112 // static | 111 // static |
| 113 ExtensionErrorUI* ExtensionErrorUI::Create( | 112 ExtensionErrorUI* ExtensionErrorUI::Create( |
| 114 ExtensionErrorUI::Delegate* delegate) { | 113 ExtensionErrorUI::Delegate* delegate) { |
| 115 return new ExtensionErrorUIDefault(delegate); | 114 return new ExtensionErrorUIDefault(delegate); |
| 116 } | 115 } |
| 117 | 116 |
| 118 } // namespace extensions | 117 } // namespace extensions |
| OLD | NEW |