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

Side by Side Diff: chrome/browser/tabs/pinned_tab_service.cc

Issue 7639002: Profiles: BROWSER_OPENED (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Same code; another round to see if flake Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tabs/pinned_tab_service.h" 5 #include "chrome/browser/tabs/pinned_tab_service.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/tabs/pinned_tab_codec.h" 8 #include "chrome/browser/tabs/pinned_tab_codec.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
12 #include "content/common/notification_service.h" 12 #include "content/common/notification_service.h"
13 13
14 static bool IsLastNormalBrowser(Browser* browser) { 14 static bool IsLastNormalBrowser(Browser* browser) {
15 for (BrowserList::const_iterator i = BrowserList::begin(); 15 for (BrowserList::const_iterator i = BrowserList::begin();
16 i != BrowserList::end(); ++i) { 16 i != BrowserList::end(); ++i) {
17 if (*i != browser && (*i)->is_type_tabbed() && 17 if (*i != browser && (*i)->is_type_tabbed() &&
18 (*i)->profile() == browser->profile()) { 18 (*i)->profile() == browser->profile()) {
19 return false; 19 return false;
20 } 20 }
21 } 21 }
22 return true; 22 return true;
23 } 23 }
24 24
25 PinnedTabService::PinnedTabService(Profile* profile) 25 PinnedTabService::PinnedTabService(Profile* profile)
26 : profile_(profile), 26 : profile_(profile),
27 got_exiting_(false), 27 got_exiting_(false),
28 has_normal_browser_(false) { 28 has_normal_browser_(false) {
29 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, 29 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
30 NotificationService::AllSources()); 30 NotificationService::AllBrowserContextsAndSources());
31 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING, 31 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
32 NotificationService::AllSources()); 32 NotificationService::AllSources());
33 registrar_.Add(this, content::NOTIFICATION_APP_EXITING, 33 registrar_.Add(this, content::NOTIFICATION_APP_EXITING,
34 NotificationService::AllSources()); 34 NotificationService::AllSources());
35 } 35 }
36 36
37 void PinnedTabService::Observe(int type, 37 void PinnedTabService::Observe(int type,
38 const NotificationSource& source, 38 const NotificationSource& source,
39 const NotificationDetails& details) { 39 const NotificationDetails& details) {
40 if (got_exiting_) 40 if (got_exiting_)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 default: 72 default:
73 NOTREACHED(); 73 NOTREACHED();
74 } 74 }
75 } 75 }
76 76
77 void PinnedTabService::GotExit() { 77 void PinnedTabService::GotExit() {
78 DCHECK(!got_exiting_); 78 DCHECK(!got_exiting_);
79 got_exiting_ = true; 79 got_exiting_ = true;
80 PinnedTabCodec::WritePinnedTabs(profile_); 80 PinnedTabCodec::WritePinnedTabs(profile_);
81 } 81 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/session_change_processor.cc ('k') | chrome/browser/ui/login/login_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698