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

Side by Side Diff: chrome/browser/ui/app_list/app_list_shower.cc

Issue 219383006: Never create an app list for an incognito profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix cros Created 6 years, 8 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
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/ui/app_list/app_list_shower.h" 8 #include "chrome/browser/ui/app_list/app_list_shower.h"
8 9
9 AppListShower::AppListShower(scoped_ptr<AppListFactory> factory, 10 AppListShower::AppListShower(scoped_ptr<AppListFactory> factory,
10 scoped_ptr<KeepAliveService> keep_alive, 11 scoped_ptr<KeepAliveService> keep_alive,
11 AppListService* service) 12 AppListService* service)
12 : factory_(factory.Pass()), 13 : factory_(factory.Pass()),
13 keep_alive_service_(keep_alive.Pass()), 14 keep_alive_service_(keep_alive.Pass()),
14 service_(service), 15 service_(service),
15 profile_(NULL), 16 profile_(NULL),
16 can_close_app_list_(true) { 17 can_close_app_list_(true) {
17 } 18 }
18 19
19 AppListShower::~AppListShower() { 20 AppListShower::~AppListShower() {
20 } 21 }
21 22
22 void AppListShower::ShowAndReacquireFocus(Profile* requested_profile) { 23 void AppListShower::ShowAndReacquireFocus(Profile* requested_profile) {
23 ShowForProfile(requested_profile); 24 ShowForProfile(requested_profile);
24 app_list_->ReactivateOnNextFocusLoss(); 25 app_list_->ReactivateOnNextFocusLoss();
25 } 26 }
26 27
27 void AppListShower::ShowForProfile(Profile* requested_profile) { 28 void AppListShower::ShowForProfile(Profile* requested_profile) {
28 // If the app list is already displaying |profile| just activate it (in case 29 // If the app list is already displaying |profile| just activate it (in case
29 // we have lost focus). 30 // we have lost focus).
30 if (IsAppListVisible() && (requested_profile == profile_)) { 31 if (IsAppListVisible() && (requested_profile->IsSameProfile(profile_))) {
32 DCHECK(profile_);
benwells 2014/10/09 05:32:33 Are these DCHECKs related to this change or just g
tapted 2014/10/09 05:52:01 semi-related. They're not being added because I ti
31 app_list_->Show(); 33 app_list_->Show();
32 return; 34 return;
33 } 35 }
34 36
35 if (!app_list_) { 37 if (!app_list_) {
36 CreateViewForProfile(requested_profile); 38 CreateViewForProfile(requested_profile);
37 } else if (requested_profile != profile_) { 39 } else if (!requested_profile->IsSameProfile(profile_)) {
38 profile_ = requested_profile; 40 DCHECK(profile_);
39 app_list_->SetProfile(requested_profile); 41 profile_ = requested_profile->GetOriginalProfile();
42 app_list_->SetProfile(profile_);
40 } 43 }
41 44
42 keep_alive_service_->EnsureKeepAlive(); 45 keep_alive_service_->EnsureKeepAlive();
43 if (!IsAppListVisible()) 46 if (!IsAppListVisible())
44 app_list_->MoveNearCursor(); 47 app_list_->MoveNearCursor();
45 app_list_->Show(); 48 app_list_->Show();
46 } 49 }
47 50
48 gfx::NativeWindow AppListShower::GetWindow() { 51 gfx::NativeWindow AppListShower::GetWindow() {
49 if (!IsAppListVisible()) 52 if (!IsAppListVisible())
50 return NULL; 53 return NULL;
51 return app_list_->GetWindow(); 54 return app_list_->GetWindow();
52 } 55 }
53 56
54 void AppListShower::CreateViewForProfile(Profile* requested_profile) { 57 void AppListShower::CreateViewForProfile(Profile* requested_profile) {
55 profile_ = requested_profile; 58 profile_ = requested_profile->GetOriginalProfile();
56 app_list_.reset(factory_->CreateAppList( 59 app_list_.reset(factory_->CreateAppList(
57 profile_, 60 profile_,
58 service_, 61 service_,
59 base::Bind(&AppListShower::DismissAppList, base::Unretained(this)))); 62 base::Bind(&AppListShower::DismissAppList, base::Unretained(this))));
60 } 63 }
61 64
62 void AppListShower::DismissAppList() { 65 void AppListShower::DismissAppList() {
63 if (app_list_ && can_close_app_list_) { 66 if (app_list_ && can_close_app_list_) {
64 app_list_->Hide(); 67 app_list_->Hide();
65 keep_alive_service_->FreeKeepAlive(); 68 keep_alive_service_->FreeKeepAlive();
(...skipping 29 matching lines...) Expand all
95 98
96 void AppListShower::WarmupForProfile(Profile* profile) { 99 void AppListShower::WarmupForProfile(Profile* profile) {
97 DCHECK(!profile_); 100 DCHECK(!profile_);
98 CreateViewForProfile(profile); 101 CreateViewForProfile(profile);
99 app_list_->Prerender(); 102 app_list_->Prerender();
100 } 103 }
101 104
102 bool AppListShower::HasView() const { 105 bool AppListShower::HasView() const {
103 return !!app_list_; 106 return !!app_list_;
104 } 107 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698