OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chrome_extensions_browser_client.h" | 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/version.h" | 8 #include "base/version.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return false; | 74 return false; |
75 #else | 75 #else |
76 // There are no browser windows open and the browser process was | 76 // There are no browser windows open and the browser process was |
77 // started to show the app launcher. | 77 // started to show the app launcher. |
78 return chrome::GetTotalBrowserCountForProfile(profile) == 0 && | 78 return chrome::GetTotalBrowserCountForProfile(profile) == 0 && |
79 CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList); | 79 CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList); |
80 #endif | 80 #endif |
81 } | 81 } |
82 | 82 |
83 bool ChromeExtensionsBrowserClient::DidVersionUpdate( | 83 bool ChromeExtensionsBrowserClient::DidVersionUpdate( |
84 ExtensionPrefs* extension_prefs) { | 84 content::BrowserContext* context) { |
| 85 Profile* profile = static_cast<Profile*>(context); |
| 86 |
85 // Unit tests may not provide prefs; assume everything is up-to-date. | 87 // Unit tests may not provide prefs; assume everything is up-to-date. |
| 88 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile); |
86 if (!extension_prefs) | 89 if (!extension_prefs) |
87 return false; | 90 return false; |
88 | 91 |
89 // If we're inside a browser test, then assume prefs are all up-to-date. | 92 // If we're inside a browser test, then assume prefs are all up-to-date. |
90 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) | 93 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) |
91 return false; | 94 return false; |
92 | 95 |
93 PrefService* pref_service = extension_prefs->pref_service(); | 96 PrefService* pref_service = extension_prefs->pref_service(); |
94 base::Version last_version; | 97 base::Version last_version; |
95 if (pref_service->HasPrefPath(prefs::kExtensionsLastChromeVersion)) { | 98 if (pref_service->HasPrefPath(prefs::kExtensionsLastChromeVersion)) { |
(...skipping 13 matching lines...) Expand all Loading... |
109 | 112 |
110 return last_version.IsOlderThan(current_version); | 113 return last_version.IsOlderThan(current_version); |
111 } | 114 } |
112 | 115 |
113 // static | 116 // static |
114 ChromeExtensionsBrowserClient* ChromeExtensionsBrowserClient::GetInstance() { | 117 ChromeExtensionsBrowserClient* ChromeExtensionsBrowserClient::GetInstance() { |
115 return g_client.Pointer(); | 118 return g_client.Pointer(); |
116 } | 119 } |
117 | 120 |
118 } // namespace extensions | 121 } // namespace extensions |
OLD | NEW |