Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #import "chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller. h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller. h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/memory/scoped_nsobject.h" 10 #include "base/memory/scoped_nsobject.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/extensions/bundle_installer.h" 14 #include "chrome/browser/extensions/bundle_installer.h"
15 #include "chrome/browser/extensions/extension_install_dialog.h" 15 #include "chrome/browser/extensions/extension_install_dialog.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_finder.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/common/extensions/extension.h" 19 #include "chrome/common/extensions/extension.h"
20 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
21 #include "skia/ext/skia_utils_mac.h" 21 #include "skia/ext/skia_utils_mac.h"
22 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" 22 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/l10n/l10n_util_mac.h" 24 #include "ui/base/l10n/l10n_util_mac.h"
25 25
26 using content::OpenURLParams; 26 using content::OpenURLParams;
27 using content::Referrer; 27 using content::Referrer;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 [NSApp beginSheet:[self window] 128 [NSApp beginSheet:[self window]
129 modalForWindow:parentWindow_ 129 modalForWindow:parentWindow_
130 modalDelegate:self 130 modalDelegate:self
131 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) 131 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
132 contextInfo:nil]; 132 contextInfo:nil];
133 } 133 }
134 134
135 - (IBAction)storeLinkClicked:(id)sender { 135 - (IBAction)storeLinkClicked:(id)sender {
136 GURL store_url(extension_urls::GetWebstoreItemDetailURLPrefix() + 136 GURL store_url(extension_urls::GetWebstoreItemDetailURLPrefix() +
137 prompt_->extension()->id()); 137 prompt_->extension()->id());
138 BrowserList::GetLastActiveWithProfile(profile_)->OpenURL(OpenURLParams( 138 browser::FindLastActiveWithProfile(profile_)->OpenURL(OpenURLParams(
139 store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, 139 store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK,
140 false)); 140 false));
141 141
142 delegate_->InstallUIAbort(/*user_initiated=*/true); 142 delegate_->InstallUIAbort(/*user_initiated=*/true);
143 [NSApp endSheet:[self window]]; 143 [NSApp endSheet:[self window]];
144 } 144 }
145 145
146 - (IBAction)cancel:(id)sender { 146 - (IBAction)cancel:(id)sender {
147 delegate_->InstallUIAbort(/*user_initiated=*/true); 147 delegate_->InstallUIAbort(/*user_initiated=*/true);
148 [NSApp endSheet:[self window]]; 148 [NSApp endSheet:[self window]];
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 [view setFrame:starBounds]; 314 [view setFrame:starBounds];
315 [ratingStars_ addSubview:view]; 315 [ratingStars_ addSubview:view];
316 } 316 }
317 317
318 @end // ExtensionInstallDialogController 318 @end // ExtensionInstallDialogController
319 319
320 void ShowExtensionInstallDialogImpl( 320 void ShowExtensionInstallDialogImpl(
321 Profile* profile, 321 Profile* profile,
322 ExtensionInstallUI::Delegate* delegate, 322 ExtensionInstallUI::Delegate* delegate,
323 const ExtensionInstallUI::Prompt& prompt) { 323 const ExtensionInstallUI::Prompt& prompt) {
324 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); 324 Browser* browser = browser::FindLastActiveWithProfile(profile);
325 if (!browser) { 325 if (!browser) {
326 delegate->InstallUIAbort(false); 326 delegate->InstallUIAbort(false);
327 return; 327 return;
328 } 328 }
329 329
330 BrowserWindow* window = browser->window(); 330 BrowserWindow* window = browser->window();
331 if (!window) { 331 if (!window) {
332 delegate->InstallUIAbort(false); 332 delegate->InstallUIAbort(false);
333 return; 333 return;
334 } 334 }
335 335
336 gfx::NativeWindow native_window = window->GetNativeHandle(); 336 gfx::NativeWindow native_window = window->GetNativeHandle();
337 337
338 ExtensionInstallDialogController* controller = 338 ExtensionInstallDialogController* controller =
339 [[ExtensionInstallDialogController alloc] 339 [[ExtensionInstallDialogController alloc]
340 initWithParentWindow:native_window 340 initWithParentWindow:native_window
341 profile:profile 341 profile:profile
342 delegate:delegate 342 delegate:delegate
343 prompt:prompt]; 343 prompt:prompt];
344 344
345 // TODO(mihaip): Switch this to be tab-modal (http://crbug.com/95455) 345 // TODO(mihaip): Switch this to be tab-modal (http://crbug.com/95455)
346 [controller runAsModalSheet]; 346 [controller runAsModalSheet];
347 } 347 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698