Chromium Code Reviews| Index: chrome/browser/offline_pages/offliner_user_data.cc |
| diff --git a/chrome/browser/offline_pages/offliner_user_data.cc b/chrome/browser/offline_pages/offliner_user_data.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..311e578ab74364c34235ab37ee81c59484323725 |
| --- /dev/null |
| +++ b/chrome/browser/offline_pages/offliner_user_data.cc |
| @@ -0,0 +1,29 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/offline_pages/offliner_user_data.h" |
| +#include "base/logging.h" // TODO: remove before checkin. |
|
Dmitry Titov
2017/05/18 02:28:10
TODO
Pete Williamson
2017/05/24 01:01:50
Done.
|
| + |
| +namespace offline_pages { |
| + |
| +void OfflinerUserData::AddToWebContents(content::WebContents* webcontents, |
| + Offliner* offliner) { |
| + DCHECK(offliner); |
| + webcontents->SetUserData(UserDataKey(), std::unique_ptr<OfflinerUserData>( |
| + new OfflinerUserData(offliner))); |
| +} |
| + |
| +// static |
| +Offliner* OfflinerUserData::OfflinerFromWebContents( |
| + content::WebContents* webcontents) { |
| + OfflinerUserData* data = OfflinerUserData::FromWebContents(webcontents); |
| + if (data) |
| + return data->offliner(); |
| + |
| + return nullptr; |
| +} |
| + |
| +} // namespace offline_pages |
| + |
| +DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerUserData); |