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

Side by Side Diff: components/sessions/ios/ios_live_tab.mm

Issue 2842833003: Update SupportsUserData uses with unique_ptr. (Closed)
Patch Set: rebase Created 3 years, 7 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 #include "components/sessions/ios/ios_live_tab.h" 5 #include "components/sessions/ios/ios_live_tab.h"
6 #include "base/memory/ptr_util.h"
6 #include "ios/web/public/navigation_manager.h" 7 #include "ios/web/public/navigation_manager.h"
7 8
8 namespace { 9 namespace {
9 const char kIOSLiveTabWebStateUserDataKey[] = "ios_live_tab"; 10 const char kIOSLiveTabWebStateUserDataKey[] = "ios_live_tab";
10 } 11 }
11 12
12 namespace sessions { 13 namespace sessions {
13 14
14 std::string IOSLiveTab::user_agent_override_; 15 std::string IOSLiveTab::user_agent_override_;
15 16
16 // static 17 // static
17 IOSLiveTab* IOSLiveTab::GetForWebState(web::WebState* web_state) { 18 IOSLiveTab* IOSLiveTab::GetForWebState(web::WebState* web_state) {
18 if (!web_state->GetUserData(kIOSLiveTabWebStateUserDataKey)) { 19 if (!web_state->GetUserData(kIOSLiveTabWebStateUserDataKey)) {
19 web_state->SetUserData(kIOSLiveTabWebStateUserDataKey, 20 web_state->SetUserData(kIOSLiveTabWebStateUserDataKey,
20 new IOSLiveTab(web_state)); 21 base::WrapUnique(new IOSLiveTab(web_state)));
21 } 22 }
22 23
23 return static_cast<IOSLiveTab*>( 24 return static_cast<IOSLiveTab*>(
24 web_state->GetUserData(kIOSLiveTabWebStateUserDataKey)); 25 web_state->GetUserData(kIOSLiveTabWebStateUserDataKey));
25 } 26 }
26 27
27 IOSLiveTab::IOSLiveTab(web::WebState* web_state) : web_state_(web_state) {} 28 IOSLiveTab::IOSLiveTab(web::WebState* web_state) : web_state_(web_state) {}
28 29
29 IOSLiveTab::~IOSLiveTab() {} 30 IOSLiveTab::~IOSLiveTab() {}
30 31
(...skipping 22 matching lines...) Expand all
53 int IOSLiveTab::GetEntryCount() { 54 int IOSLiveTab::GetEntryCount() {
54 return navigation_manager()->GetItemCount(); 55 return navigation_manager()->GetItemCount();
55 } 56 }
56 57
57 const std::string& IOSLiveTab::GetUserAgentOverride() const { 58 const std::string& IOSLiveTab::GetUserAgentOverride() const {
58 // Dynamic user agent overrides are not supported on iOS. 59 // Dynamic user agent overrides are not supported on iOS.
59 return user_agent_override_; 60 return user_agent_override_;
60 } 61 }
61 62
62 } // namespace sessions 63 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698