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

Side by Side Diff: chrome/browser/ui/network_profile_bubble.cc

Issue 10690151: Move implementation of BrowserList onto an inner, instantiatable class, BrowserListImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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/network_profile_bubble.h" 5 #include "chrome/browser/ui/network_profile_bubble.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <wtsapi32.h> 9 #include <wtsapi32.h>
10 // Make sure we link the wtsapi lib file in. 10 // Make sure we link the wtsapi lib file in.
11 #pragma comment(lib, "wtsapi32.lib") 11 #pragma comment(lib, "wtsapi32.lib")
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/file_util.h" 16 #include "base/file_util.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/prefs/pref_service.h" 21 #include "chrome/browser/prefs/pref_service.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
24 #include "chrome/browser/ui/browser_list_observer.h"
24 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
26 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
27 28
28 namespace { 29 namespace {
29 30
30 // The duration of the silent period before we start nagging the user again. 31 // The duration of the silent period before we start nagging the user again.
31 const int kSilenceDurationDays = 100; 32 const int kSilenceDurationDays = 100;
32 33
33 // The number of warnings to be shown on consequtive starts of Chrome before the 34 // The number of warnings to be shown on consequtive starts of Chrome before the
34 // silent period starts. 35 // silent period starts.
35 const int kMaxWarnings = 2; 36 const int kMaxWarnings = 2;
36 37
37 // Implementation of BrowserList::Observer used to wait for a browser window. 38 // Implementation of chrome::BrowserListObserver used to wait for a browser
38 class BrowserListObserver : public BrowserList::Observer { 39 // window.
40 class BrowserListObserver : public chrome::BrowserListObserver {
39 private: 41 private:
40 virtual ~BrowserListObserver(); 42 virtual ~BrowserListObserver();
41 43
42 // Overridden from BrowserList::Observer: 44 // Overridden from chrome::BrowserListObserver:
43 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; 45 virtual void OnBrowserAdded(Browser* browser) OVERRIDE;
44 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; 46 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE;
45 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; 47 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE;
46 }; 48 };
47 49
48 BrowserListObserver::~BrowserListObserver() { 50 BrowserListObserver::~BrowserListObserver() {
49 } 51 }
50 52
51 void BrowserListObserver::OnBrowserAdded(Browser* browser) { 53 void BrowserListObserver::OnBrowserAdded(Browser* browser) {
52 } 54 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 METRIC_NETWORKED_PROFILE_CHECK_SIZE); 170 METRIC_NETWORKED_PROFILE_CHECK_SIZE);
169 } 171 }
170 172
171 // static 173 // static
172 void NetworkProfileBubble::NotifyNetworkProfileDetected() { 174 void NetworkProfileBubble::NotifyNetworkProfileDetected() {
173 if (BrowserList::GetLastActive()) 175 if (BrowserList::GetLastActive())
174 ShowNotification(BrowserList::GetLastActive()); 176 ShowNotification(BrowserList::GetLastActive());
175 else 177 else
176 BrowserList::AddObserver(new BrowserListObserver()); 178 BrowserList::AddObserver(new BrowserListObserver());
177 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698