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/bundle_installer.h" | 5 #include "chrome/browser/extensions/bundle_installer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 g_auto_approve_for_test = auto_approve ? PROCEED : ABORT; | 86 g_auto_approve_for_test = auto_approve ? PROCEED : ABORT; |
87 } | 87 } |
88 | 88 |
89 BundleInstaller::Item::Item() : state(STATE_PENDING) {} | 89 BundleInstaller::Item::Item() : state(STATE_PENDING) {} |
90 | 90 |
91 BundleInstaller::Item::~Item() {} | 91 BundleInstaller::Item::~Item() {} |
92 | 92 |
93 base::string16 BundleInstaller::Item::GetNameForDisplay() const { | 93 base::string16 BundleInstaller::Item::GetNameForDisplay() const { |
94 base::string16 name = base::UTF8ToUTF16(localized_name); | 94 base::string16 name = base::UTF8ToUTF16(localized_name); |
95 base::i18n::AdjustStringForLocaleDirection(&name); | 95 base::i18n::AdjustStringForLocaleDirection(&name); |
96 return l10n_util::GetStringFUTF16(IDS_EXTENSION_PERMISSION_LINE, name); | 96 return name; |
97 } | 97 } |
98 | 98 |
99 BundleInstaller::BundleInstaller(Browser* browser, | 99 BundleInstaller::BundleInstaller(Browser* browser, |
100 const std::string& name, | 100 const std::string& name, |
101 const SkBitmap& icon, | 101 const SkBitmap& icon, |
102 const std::string& authuser, | 102 const std::string& authuser, |
103 const BundleInstaller::ItemList& items) | 103 const BundleInstaller::ItemList& items) |
104 : approved_(false), | 104 : approved_(false), |
105 browser_(browser), | 105 browser_(browser), |
106 name_(name), | 106 name_(name), |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 Browser* browser = browser_; | 270 Browser* browser = browser_; |
271 if (!browser) { | 271 if (!browser) { |
272 // The browser that we got initially could have gone away during our | 272 // The browser that we got initially could have gone away during our |
273 // thread hopping. | 273 // thread hopping. |
274 browser = chrome::FindLastActiveWithProfile(profile_, host_desktop_type_); | 274 browser = chrome::FindLastActiveWithProfile(profile_, host_desktop_type_); |
275 } | 275 } |
276 content::WebContents* web_contents = NULL; | 276 content::WebContents* web_contents = NULL; |
277 if (browser) | 277 if (browser) |
278 web_contents = browser->tab_strip_model()->GetActiveWebContents(); | 278 web_contents = browser->tab_strip_model()->GetActiveWebContents(); |
279 install_ui_.reset(new ExtensionInstallPrompt(web_contents)); | 279 install_ui_.reset(new ExtensionInstallPrompt(web_contents)); |
280 install_ui_->ConfirmBundleInstall(this, permissions.get()); | 280 install_ui_->ConfirmBundleInstall(this, &icon_, permissions.get()); |
281 } | 281 } |
282 } | 282 } |
283 | 283 |
284 void BundleInstaller::ShowInstalledBubbleIfDone() { | 284 void BundleInstaller::ShowInstalledBubbleIfDone() { |
285 // We're ready to show the installed bubble when no items are pending. | 285 // We're ready to show the installed bubble when no items are pending. |
286 if (HasItemWithState(Item::STATE_PENDING)) | 286 if (HasItemWithState(Item::STATE_PENDING)) |
287 return; | 287 return; |
288 | 288 |
289 if (browser_) | 289 if (browser_) |
290 ShowInstalledBubble(this, browser_); | 290 ShowInstalledBubble(this, browser_); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 ShowInstalledBubbleIfDone(); | 348 ShowInstalledBubbleIfDone(); |
349 } | 349 } |
350 | 350 |
351 void BundleInstaller::OnBrowserRemoved(Browser* browser) { | 351 void BundleInstaller::OnBrowserRemoved(Browser* browser) { |
352 if (browser_ == browser) | 352 if (browser_ == browser) |
353 browser_ = nullptr; | 353 browser_ = nullptr; |
354 } | 354 } |
355 | 355 |
356 } // namespace extensions | 356 } // namespace extensions |
OLD | NEW |