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

Side by Side Diff: ios/chrome/browser/tabs/legacy_tab_helper.h

Issue 2681843002: Add mechanism to get the Tab from the associated WebState. (Closed)
Patch Set: Address comments. Created 3 years, 10 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
« no previous file with comments | « ios/chrome/browser/tabs/BUILD.gn ('k') | ios/chrome/browser/tabs/legacy_tab_helper.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_TABS_LEGACY_TAB_HELPER_H_
6 #define IOS_CHROME_BROWSER_TABS_LEGACY_TAB_HELPER_H_
7
8 #import "base/ios/weak_nsobject.h"
9 #include "base/macros.h"
10 #import "ios/web/public/web_state/web_state_user_data.h"
11
12 @class Tab;
13
14 // LegacyTabHelper allows to access to the Tab owning a given WebState for
15 // interoperability of code using WebStates with legacy code using Tabs.
16 class LegacyTabHelper : public web::WebStateUserData<LegacyTabHelper> {
17 public:
18 // Creates the LegacyTabHelper to record the association of |web_state|
19 // with |tab|. It is an error if |web_state| is already associated with
20 // another Tab.
21 static void CreateForWebState(web::WebState* web_state, Tab* tab);
22
23 // Returns the Tab associated with |web_state| if it exists or nil.
24 static Tab* GetTabForWebState(web::WebState* web_state);
25
26 private:
27 LegacyTabHelper(web::WebState* web_state, Tab* tab);
28 ~LegacyTabHelper() override;
29
30 // The Tab instance associated with the WebState. The Tab currently owns
31 // the WebState, so this should only be nil between the call to -[Tab close]
32 // and the object is deallocated.
33 base::WeakNSObject<Tab> tab_;
34
35 DISALLOW_COPY_AND_ASSIGN(LegacyTabHelper);
36 };
37
38 #endif // IOS_CHROME_BROWSER_TABS_LEGACY_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/BUILD.gn ('k') | ios/chrome/browser/tabs/legacy_tab_helper.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698