| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 IOS_SHARED_CHROME_BROWSER_UI_BROWSER_LIST_BROWSER_H_ | 5 #ifndef IOS_SHARED_CHROME_BROWSER_UI_BROWSER_LIST_BROWSER_H_ |
| 6 #define IOS_SHARED_CHROME_BROWSER_UI_BROWSER_LIST_BROWSER_H_ | 6 #define IOS_SHARED_CHROME_BROWSER_UI_BROWSER_LIST_BROWSER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/supports_user_data.h" |
| 11 | 12 |
| 12 class WebStateList; | 13 class WebStateList; |
| 13 class WebStateListDelegate; | 14 class WebStateListDelegate; |
| 14 | 15 |
| 15 @class ChromeBroadcaster; | 16 @class ChromeBroadcaster; |
| 16 @class CommandDispatcher; | 17 @class CommandDispatcher; |
| 17 | 18 |
| 18 namespace ios { | 19 namespace ios { |
| 19 class ChromeBrowserState; | 20 class ChromeBrowserState; |
| 20 } | 21 } |
| 21 | 22 |
| 22 // Browser holds the state backing a collection of Tabs and the attached | 23 // Browser holds the state backing a collection of Tabs and the attached |
| 23 // UI elements (Tab strip, ...). | 24 // UI elements (Tab strip, ...). |
| 24 class Browser { | 25 class Browser : public base::SupportsUserData { |
| 25 public: | 26 public: |
| 26 explicit Browser(ios::ChromeBrowserState* browser_state); | 27 explicit Browser(ios::ChromeBrowserState* browser_state); |
| 27 ~Browser(); | 28 ~Browser() override; |
| 28 | 29 |
| 29 WebStateList& web_state_list() { return *web_state_list_.get(); } | 30 WebStateList& web_state_list() { return *web_state_list_.get(); } |
| 30 const WebStateList& web_state_list() const { return *web_state_list_.get(); } | 31 const WebStateList& web_state_list() const { return *web_state_list_.get(); } |
| 31 | 32 |
| 32 CommandDispatcher* dispatcher() { return dispatcher_; } | 33 CommandDispatcher* dispatcher() { return dispatcher_; } |
| 33 | 34 |
| 34 ios::ChromeBrowserState* browser_state() const { return browser_state_; } | 35 ios::ChromeBrowserState* browser_state() const { return browser_state_; } |
| 35 | 36 |
| 36 ChromeBroadcaster* broadcaster() { return broadcaster_; } | 37 ChromeBroadcaster* broadcaster() { return broadcaster_; } |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 __strong ChromeBroadcaster* broadcaster_; | 40 __strong ChromeBroadcaster* broadcaster_; |
| 40 __strong CommandDispatcher* dispatcher_; | 41 __strong CommandDispatcher* dispatcher_; |
| 41 ios::ChromeBrowserState* browser_state_; | 42 ios::ChromeBrowserState* browser_state_; |
| 42 std::unique_ptr<WebStateListDelegate> web_state_list_delegate_; | 43 std::unique_ptr<WebStateListDelegate> web_state_list_delegate_; |
| 43 std::unique_ptr<WebStateList> web_state_list_; | 44 std::unique_ptr<WebStateList> web_state_list_; |
| 44 | 45 |
| 45 DISALLOW_COPY_AND_ASSIGN(Browser); | 46 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 #endif // IOS_SHARED_CHROME_BROWSER_UI_BROWSER_LIST_BROWSER_H_ | 49 #endif // IOS_SHARED_CHROME_BROWSER_UI_BROWSER_LIST_BROWSER_H_ |
| OLD | NEW |