OLD | NEW |
(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 #include "chrome/browser/offline_pages/offliner_user_data.h" |
| 6 #include "base/logging.h" // TODO: remove before checkin. |
| 7 |
| 8 namespace offline_pages { |
| 9 |
| 10 void OfflinerUserData::AddToWebContents(content::WebContents* webcontents, |
| 11 Offliner* offliner) { |
| 12 DCHECK(offliner); |
| 13 webcontents->SetUserData(UserDataKey(), std::unique_ptr<OfflinerUserData>( |
| 14 new OfflinerUserData(offliner))); |
| 15 } |
| 16 |
| 17 // static |
| 18 Offliner* OfflinerUserData::OfflinerFromWebContents( |
| 19 content::WebContents* webcontents) { |
| 20 OfflinerUserData* data = OfflinerUserData::FromWebContents(webcontents); |
| 21 if (data) |
| 22 return data->offliner(); |
| 23 |
| 24 return nullptr; |
| 25 } |
| 26 |
| 27 } // namespace offline_pages |
| 28 |
| 29 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerUserData); |
OLD | NEW |