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/ui/extensions/extension_install_ui_default.h" | 5 #include "chrome/browser/ui/extensions/extension_install_ui_default.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 using content::WebContents; | 50 using content::WebContents; |
51 using extensions::Extension; | 51 using extensions::Extension; |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 Browser* FindOrCreateVisibleBrowser(Profile* profile) { | 55 Browser* FindOrCreateVisibleBrowser(Profile* profile) { |
56 // TODO(mpcomplete): remove this workaround for http://crbug.com/244246 | 56 // TODO(mpcomplete): remove this workaround for http://crbug.com/244246 |
57 // after fixing http://crbug.com/38676. | 57 // after fixing http://crbug.com/38676. |
58 if (!IncognitoModePrefs::CanOpenBrowser(profile)) | 58 if (!IncognitoModePrefs::CanOpenBrowser(profile)) |
59 return NULL; | 59 return NULL; |
60 chrome::ScopedTabbedBrowserDisplayer displayer( | 60 chrome::ScopedTabbedBrowserDisplayer displayer(profile); |
61 profile, chrome::GetActiveDesktop()); | |
62 Browser* browser = displayer.browser(); | 61 Browser* browser = displayer.browser(); |
63 if (browser->tab_strip_model()->count() == 0) | 62 if (browser->tab_strip_model()->count() == 0) |
64 chrome::AddTabAt(browser, GURL(), -1, true); | 63 chrome::AddTabAt(browser, GURL(), -1, true); |
65 return browser; | 64 return browser; |
66 } | 65 } |
67 | 66 |
68 void ShowExtensionInstalledBubble(const extensions::Extension* extension, | 67 void ShowExtensionInstalledBubble(const extensions::Extension* extension, |
69 Profile* profile, | 68 Profile* profile, |
70 const SkBitmap& icon) { | 69 const SkBitmap& icon) { |
71 Browser* browser = FindOrCreateVisibleBrowser(profile); | 70 Browser* browser = FindOrCreateVisibleBrowser(profile); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 255 |
257 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { | 256 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { |
258 Browser* browser = chrome::FindLastActiveWithProfile(profile_); | 257 Browser* browser = chrome::FindLastActiveWithProfile(profile_); |
259 if (browser) { | 258 if (browser) { |
260 content::WebContents* contents = | 259 content::WebContents* contents = |
261 browser->tab_strip_model()->GetActiveWebContents(); | 260 browser->tab_strip_model()->GetActiveWebContents(); |
262 return contents->GetTopLevelNativeWindow(); | 261 return contents->GetTopLevelNativeWindow(); |
263 } | 262 } |
264 return NULL; | 263 return NULL; |
265 } | 264 } |
OLD | NEW |