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

Side by Side Diff: chrome/browser/extensions/chrome_extensions_browser_client.cc

Issue 52983004: Convert ExtensionProcessManager to BrowserContext, part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, add browser test Created 7 years, 1 month 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 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 "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/browser/ui/browser_finder.h"
12 #include "chrome/common/chrome_switches.h"
9 13
10 namespace extensions { 14 namespace extensions {
11 15
12 namespace { 16 namespace {
13 17
14 static base::LazyInstance<ChromeExtensionsBrowserClient> g_client = 18 static base::LazyInstance<ChromeExtensionsBrowserClient> g_client =
15 LAZY_INSTANCE_INITIALIZER; 19 LAZY_INSTANCE_INITIALIZER;
16 20
17 } // namespace 21 } // namespace
18 22
(...skipping 15 matching lines...) Expand all
34 bool ChromeExtensionsBrowserClient::HasOffTheRecordContext( 38 bool ChromeExtensionsBrowserClient::HasOffTheRecordContext(
35 content::BrowserContext* context) { 39 content::BrowserContext* context) {
36 return static_cast<Profile*>(context)->HasOffTheRecordProfile(); 40 return static_cast<Profile*>(context)->HasOffTheRecordProfile();
37 } 41 }
38 42
39 content::BrowserContext* ChromeExtensionsBrowserClient::GetOffTheRecordContext( 43 content::BrowserContext* ChromeExtensionsBrowserClient::GetOffTheRecordContext(
40 content::BrowserContext* context) { 44 content::BrowserContext* context) {
41 return static_cast<Profile*>(context)->GetOffTheRecordProfile(); 45 return static_cast<Profile*>(context)->GetOffTheRecordProfile();
42 } 46 }
43 47
48 content::BrowserContext* ChromeExtensionsBrowserClient::GetOriginalContext(
49 content::BrowserContext* context) {
50 return static_cast<Profile*>(context)->GetOriginalProfile();
miket_OOO 2013/10/31 23:04:53 This is probably already covered by your "all the
James Cook 2013/11/01 00:08:32 These casts have to stay, as do all the others in
51 }
52
53 bool ChromeExtensionsBrowserClient::DeferLoadingBackgroundHosts(
54 content::BrowserContext* context) const {
55 Profile* profile = static_cast<Profile*>(context);
56
57 // The profile may not be valid yet if it is still being initialized.
58 // In that case, defer loading, since it depends on an initialized profile.
59 // http://crbug.com/222473
60 if (!g_browser_process->profile_manager()->IsValidProfile(profile))
61 return true;
62
63 #if defined(OS_ANDROID)
64 return false;
65 #else
66 // There are no browser windows open and the browser process was
67 // started to show the app launcher.
68 return chrome::GetTotalBrowserCountForProfile(profile) == 0 &&
69 CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList);
70 #endif
71 }
72
44 // static 73 // static
45 ChromeExtensionsBrowserClient* ChromeExtensionsBrowserClient::GetInstance() { 74 ChromeExtensionsBrowserClient* ChromeExtensionsBrowserClient::GetInstance() {
46 return g_client.Pointer(); 75 return g_client.Pointer();
47 } 76 }
48 77
49 } // namespace extensions 78 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698