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

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

Issue 10779042: Move notifications only used in chrome/ to chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix oops Created 8 years, 5 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) 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/tabs/pinned_tab_service.h" 5 #include "chrome/browser/ui/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/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_list.h" 9 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" 10 #include "chrome/browser/ui/tabs/pinned_tab_codec.h"
(...skipping 12 matching lines...) Expand all
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 content::NotificationService::AllBrowserContextsAndSources()); 30 content::NotificationService::AllBrowserContextsAndSources());
31 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING, 31 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
32 content::NotificationService::AllSources()); 32 content::NotificationService::AllSources());
33 registrar_.Add(this, content::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, 33 registrar_.Add(this, chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
34 content::NotificationService::AllSources()); 34 content::NotificationService::AllSources());
35 } 35 }
36 36
37 void PinnedTabService::Observe(int type, 37 void PinnedTabService::Observe(int type,
38 const content::NotificationSource& source, 38 const content::NotificationSource& source,
39 const content::NotificationDetails& details) { 39 const content::NotificationDetails& details) {
40 if (got_exiting_) 40 if (got_exiting_)
41 return; 41 return;
42 42
43 switch (type) { 43 switch (type) {
(...skipping 12 matching lines...) Expand all
56 if (*(content::Details<bool>(details)).ptr()) { 56 if (*(content::Details<bool>(details)).ptr()) {
57 GotExit(); 57 GotExit();
58 } else if (IsLastNormalBrowser(browser)) { 58 } else if (IsLastNormalBrowser(browser)) {
59 has_normal_browser_ = false; 59 has_normal_browser_ = false;
60 PinnedTabCodec::WritePinnedTabs(profile_); 60 PinnedTabCodec::WritePinnedTabs(profile_);
61 } 61 }
62 } 62 }
63 break; 63 break;
64 } 64 }
65 65
66 case content::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST: { 66 case chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST: {
67 if (has_normal_browser_) 67 if (has_normal_browser_)
68 GotExit(); 68 GotExit();
69 break; 69 break;
70 } 70 }
71 71
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

Powered by Google App Engine
This is Rietveld 408576698