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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/extensions/bundle_installer.h" | 12 #include "chrome/browser/extensions/bundle_installer.h" |
13 #include "chrome/browser/extensions/extension_install_dialog.h" | 13 #include "chrome/browser/extensions/extension_install_dialog.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/views/border.h" | 22 #include "ui/views/border.h" |
22 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
23 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
24 #include "ui/views/controls/link.h" | 25 #include "ui/views/controls/link.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, | 346 store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, |
346 false); | 347 false); |
347 BrowserList::GetLastActive()->OpenURL(params); | 348 BrowserList::GetLastActive()->OpenURL(params); |
348 GetWidget()->Close(); | 349 GetWidget()->Close(); |
349 } | 350 } |
350 | 351 |
351 void ShowExtensionInstallDialogImpl( | 352 void ShowExtensionInstallDialogImpl( |
352 Profile* profile, | 353 Profile* profile, |
353 ExtensionInstallUI::Delegate* delegate, | 354 ExtensionInstallUI::Delegate* delegate, |
354 const ExtensionInstallUI::Prompt& prompt) { | 355 const ExtensionInstallUI::Prompt& prompt) { |
355 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 356 Browser* browser = browser::FindLastActiveWithProfile(profile); |
356 if (!browser) { | 357 if (!browser) { |
357 delegate->InstallUIAbort(false); | 358 delegate->InstallUIAbort(false); |
358 return; | 359 return; |
359 } | 360 } |
360 | 361 |
361 BrowserWindow* browser_window = browser->window(); | 362 BrowserWindow* browser_window = browser->window(); |
362 if (!browser_window) { | 363 if (!browser_window) { |
363 delegate->InstallUIAbort(false); | 364 delegate->InstallUIAbort(false); |
364 return; | 365 return; |
365 } | 366 } |
366 | 367 |
367 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( | 368 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( |
368 delegate, prompt); | 369 delegate, prompt); |
369 | 370 |
370 views::Widget* window = views::Widget::CreateWindowWithParent( | 371 views::Widget* window = views::Widget::CreateWindowWithParent( |
371 dialog, browser_window->GetNativeHandle()); | 372 dialog, browser_window->GetNativeHandle()); |
372 window->Show(); | 373 window->Show(); |
373 } | 374 } |
OLD | NEW |