summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 21:50:01 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 21:50:01 +0000
commit32fc4ff7d286f7a6ee80d969672cdadaa8d3e8d0 (patch)
treec7e59d81962c173d61083003c07819c2805fd042 /chrome/browser/ui/cocoa
parent080245fa243e0c04ccea332660d3058f710a090c (diff)
downloadchromium_src-32fc4ff7d286f7a6ee80d969672cdadaa8d3e8d0.zip
chromium_src-32fc4ff7d286f7a6ee80d969672cdadaa8d3e8d0.tar.gz
chromium_src-32fc4ff7d286f7a6ee80d969672cdadaa8d3e8d0.tar.bz2
Remove BrowserList::GetLastActive from extensions install dialog code by plumbing through the Browser window. In two places (file_manager_util.cc and download_crx_util.cc) there is no context so I left those with FindLastActiveWithProfile for now.
BUG=129187 Review URL: https://chromiumcodereview.appspot.com/10548057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/cocoa')
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h6
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm16
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm16
3 files changed, 16 insertions, 22 deletions
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h
index 9c8429f..2ec83f3 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h
@@ -15,7 +15,7 @@
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "ui/gfx/image/image_skia.h"
-class Profile;
+class Browser;
// Displays the extension or bundle install prompt, and notifies the
// ExtensionInstallPrompt::Delegate of success or failure.
@@ -38,7 +38,7 @@ class Profile;
IBOutlet NSTextField* userCountField_;
NSWindow* parentWindow_; // weak
- Profile* profile_; // weak
+ Browser* browser_; // weak
ExtensionInstallPrompt::Delegate* delegate_; // weak
scoped_ptr<ExtensionInstallPrompt::Prompt> prompt_;
}
@@ -57,7 +57,7 @@ class Profile;
@property(nonatomic, readonly) NSTextField* userCountField;
- (id)initWithParentWindow:(NSWindow*)window
- profile:(Profile*)profile
+ browser:(Browser*)browser
delegate:(ExtensionInstallPrompt::Delegate*)delegate
prompt:(const ExtensionInstallPrompt::Prompt&)prompt;
- (void)runAsModalSheet;
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm
index 0561ca2..313b8fb 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm
@@ -89,7 +89,7 @@ void AppendRatingStarsShim(const gfx::ImageSkia* skiaImage, void* data) {
@synthesize userCountField = userCountField_;
- (id)initWithParentWindow:(NSWindow*)window
- profile:(Profile*)profile
+ browser:(Browser*)browser
delegate:(ExtensionInstallPrompt::Delegate*)delegate
prompt:(const ExtensionInstallPrompt::Prompt&)prompt {
NSString* nibpath = nil;
@@ -117,7 +117,7 @@ void AppendRatingStarsShim(const gfx::ImageSkia* skiaImage, void* data) {
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
parentWindow_ = window;
- profile_ = profile;
+ browser_ = browser;
delegate_ = delegate;
prompt_.reset(new ExtensionInstallPrompt::Prompt(prompt));
}
@@ -135,7 +135,7 @@ void AppendRatingStarsShim(const gfx::ImageSkia* skiaImage, void* data) {
- (IBAction)storeLinkClicked:(id)sender {
GURL store_url(extension_urls::GetWebstoreItemDetailURLPrefix() +
prompt_->extension()->id());
- browser::FindLastActiveWithProfile(profile_)->OpenURL(OpenURLParams(
+ browser_->OpenURL(OpenURLParams(
store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK,
false));
@@ -318,15 +318,9 @@ void AppendRatingStarsShim(const gfx::ImageSkia* skiaImage, void* data) {
@end // ExtensionInstallDialogController
void ShowExtensionInstallDialogImpl(
- Profile* profile,
+ Browser* browser,
ExtensionInstallPrompt::Delegate* delegate,
const ExtensionInstallPrompt::Prompt& prompt) {
- Browser* browser = browser::FindLastActiveWithProfile(profile);
- if (!browser) {
- delegate->InstallUIAbort(false);
- return;
- }
-
BrowserWindow* window = browser->window();
if (!window) {
delegate->InstallUIAbort(false);
@@ -338,7 +332,7 @@ void ShowExtensionInstallDialogImpl(
ExtensionInstallDialogController* controller =
[[ExtensionInstallDialogController alloc]
initWithParentWindow:native_window
- profile:profile
+ browser:browser
delegate:delegate
prompt:prompt];
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm
index 4ddb9db..fc9266d 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm
@@ -119,9 +119,9 @@ TEST_F(ExtensionInstallDialogControllerTest, BasicsNormalCancel) {
scoped_nsobject<ExtensionInstallDialogController>
controller([[ExtensionInstallDialogController alloc]
initWithParentWindow:test_window()
- profile:profile()
- delegate:&delegate
- prompt:prompt]);
+ browser:browser()
+ delegate:&delegate
+ prompt:prompt]);
[controller window]; // force nib load
@@ -175,7 +175,7 @@ TEST_F(ExtensionInstallDialogControllerTest, BasicsNormalOK) {
scoped_nsobject<ExtensionInstallDialogController>
controller([[ExtensionInstallDialogController alloc]
initWithParentWindow:test_window()
- profile:profile()
+ browser:browser()
delegate:&delegate
prompt:prompt]);
@@ -210,7 +210,7 @@ TEST_F(ExtensionInstallDialogControllerTest, MultipleWarnings) {
scoped_nsobject<ExtensionInstallDialogController>
controller1([[ExtensionInstallDialogController alloc]
initWithParentWindow:test_window()
- profile:profile()
+ browser:browser()
delegate:&delegate1
prompt:one_warning_prompt]);
@@ -219,7 +219,7 @@ TEST_F(ExtensionInstallDialogControllerTest, MultipleWarnings) {
scoped_nsobject<ExtensionInstallDialogController>
controller2([[ExtensionInstallDialogController alloc]
initWithParentWindow:test_window()
- profile:profile()
+ browser:browser()
delegate:&delegate2
prompt:two_warnings_prompt]);
@@ -255,7 +255,7 @@ TEST_F(ExtensionInstallDialogControllerTest, BasicsSkinny) {
scoped_nsobject<ExtensionInstallDialogController>
controller([[ExtensionInstallDialogController alloc]
initWithParentWindow:test_window()
- profile:profile()
+ browser:browser()
delegate:&delegate
prompt:no_warnings_prompt]);
@@ -301,7 +301,7 @@ TEST_F(ExtensionInstallDialogControllerTest, BasicsInline) {
scoped_nsobject<ExtensionInstallDialogController>
controller([[ExtensionInstallDialogController alloc]
initWithParentWindow:test_window()
- profile:profile()
+ browser:browser()
delegate:&delegate
prompt:inline_prompt]);