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

Side by Side Diff: chrome/browser/ui/browser_tab_strip_tracker.h

Issue 2741053005: [Chrome OS] Clean up BrowserTabStripTracker Init parameter. (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_UI_BROWSER_TAB_STRIP_TRACKER_H_ 5 #ifndef CHROME_BROWSER_UI_BROWSER_TAB_STRIP_TRACKER_H_
6 #define CHROME_BROWSER_UI_BROWSER_TAB_STRIP_TRACKER_H_ 6 #define CHROME_BROWSER_UI_BROWSER_TAB_STRIP_TRACKER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 10 matching lines...) Expand all
21 // BrowserTabStripTrackerDelegate. BrowserTabStripTracker queries the delegate 21 // BrowserTabStripTrackerDelegate. BrowserTabStripTracker queries the delegate
22 // for each Browser to determine if the Browser should be tracked. A null 22 // for each Browser to determine if the Browser should be tracked. A null
23 // delegate indicates all Browsers should be observed. 23 // delegate indicates all Browsers should be observed.
24 // 24 //
25 // If you are interested in BrowserListObserver functions specify a 25 // If you are interested in BrowserListObserver functions specify a
26 // BrowserListObserver in the constructor. OnBrowserAdded() and 26 // BrowserListObserver in the constructor. OnBrowserAdded() and
27 // OnBrowserRemoved() are only called if the delegate indicates the browser 27 // OnBrowserRemoved() are only called if the delegate indicates the browser
28 // should be tracked. 28 // should be tracked.
29 class BrowserTabStripTracker : public chrome::BrowserListObserver { 29 class BrowserTabStripTracker : public chrome::BrowserListObserver {
30 public: 30 public:
31 // See Init() for details.
32 enum class InitWith {
33 BROWSERS_IN_ACTIVE_DESKTOP,
34 ALL_BROWERS,
35 };
36
37 // See class description for details. You only need specify a 31 // See class description for details. You only need specify a
38 // TabStripModelObserver. |delegate| and |browser_list_observer| are 32 // TabStripModelObserver. |delegate| and |browser_list_observer| are
39 // optional. 33 // optional.
40 BrowserTabStripTracker(TabStripModelObserver* tab_strip_model_observer, 34 BrowserTabStripTracker(TabStripModelObserver* tab_strip_model_observer,
41 BrowserTabStripTrackerDelegate* delegate, 35 BrowserTabStripTrackerDelegate* delegate,
42 BrowserListObserver* browser_list_observer); 36 BrowserListObserver* browser_list_observer);
43 ~BrowserTabStripTracker() override; 37 ~BrowserTabStripTracker() override;
44 38
45 // Starts tracking BrowserList for changes and additionally observes the 39 // Starts tracking BrowserList for changes and additionally observes the
46 // existing Browsers matching |init_with|. If there is a 40 // existing Browsers. If there is a BrowserTabStripTrackerDelegate it is
47 // BrowserTabStripTrackerDelegate it is called to determine if the Browser 41 // called to determine if the Browser should be observed. If an existing
48 // should be observed. If an existing Browser should be observed 42 // Browser should be observed TabInsertedAt() is called for any existing tabs.
49 // TabInsertedAt() is called for any existing tabs. If a delegate needs to 43 // If a delegate needs to differentiate between Browsers observed by way of
50 // differentiate between Browsers observed by way of Init() vs. a Browser 44 // Init() vs. a Browser added after the fact use
51 // added after the fact use is_processing_initial_browsers(). 45 // is_processing_initial_browsers().
52 void Init(InitWith init_with); 46 void Init();
53 47
54 // Returns true if processing an existing Browser in Init(). 48 // Returns true if processing an existing Browser in Init().
55 bool is_processing_initial_browsers() const { 49 bool is_processing_initial_browsers() const {
56 return is_processing_initial_browsers_; 50 return is_processing_initial_browsers_;
57 } 51 }
58 52
59 // Stops observing the current set of observed browsers and calls 53 // Stops observing the current set of observed browsers and calls
60 // BrowserListObserver::OnBrowserRemoved(). 54 // BrowserListObserver::OnBrowserRemoved().
61 void StopObservingAndSendOnBrowserRemoved(); 55 void StopObservingAndSendOnBrowserRemoved();
62 56
(...skipping 15 matching lines...) Expand all
78 TabStripModelObserver* tab_strip_model_observer_; 72 TabStripModelObserver* tab_strip_model_observer_;
79 BrowserTabStripTrackerDelegate* delegate_; 73 BrowserTabStripTrackerDelegate* delegate_;
80 BrowserListObserver* browser_list_observer_; 74 BrowserListObserver* browser_list_observer_;
81 bool is_processing_initial_browsers_; 75 bool is_processing_initial_browsers_;
82 Browsers browsers_observing_; 76 Browsers browsers_observing_;
83 77
84 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripTracker); 78 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripTracker);
85 }; 79 };
86 80
87 #endif // CHROME_BROWSER_UI_BROWSER_TAB_STRIP_TRACKER_H_ 81 #endif // CHROME_BROWSER_UI_BROWSER_TAB_STRIP_TRACKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/browser_status_monitor.cc ('k') | chrome/browser/ui/browser_tab_strip_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698