| 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 #include "content/browser/background_fetch/background_fetch_service_impl.h" | 5 #include "content/browser/background_fetch/background_fetch_service_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/optional.h" | 9 #include "base/optional.h" |
| 10 #include "content/browser/background_fetch/background_fetch_context.h" | 10 #include "content/browser/background_fetch/background_fetch_context.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // Maximum length of a developer-provided title for a Background Fetch. | 28 // Maximum length of a developer-provided title for a Background Fetch. |
| 29 constexpr size_t kMaxTitleLength = 1024 * 1024; | 29 constexpr size_t kMaxTitleLength = 1024 * 1024; |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 void BackgroundFetchServiceImpl::Create( | 34 void BackgroundFetchServiceImpl::Create( |
| 35 int render_process_id, | 35 int render_process_id, |
| 36 scoped_refptr<BackgroundFetchContext> background_fetch_context, | 36 scoped_refptr<BackgroundFetchContext> background_fetch_context, |
| 37 const service_manager::BindSourceInfo& source_info, |
| 37 blink::mojom::BackgroundFetchServiceRequest request) { | 38 blink::mojom::BackgroundFetchServiceRequest request) { |
| 38 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 39 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 39 mojo::MakeStrongBinding( | 40 mojo::MakeStrongBinding( |
| 40 base::MakeUnique<BackgroundFetchServiceImpl>( | 41 base::MakeUnique<BackgroundFetchServiceImpl>( |
| 41 render_process_id, std::move(background_fetch_context)), | 42 render_process_id, std::move(background_fetch_context)), |
| 42 std::move(request)); | 43 std::move(request)); |
| 43 } | 44 } |
| 44 | 45 |
| 45 BackgroundFetchServiceImpl::BackgroundFetchServiceImpl( | 46 BackgroundFetchServiceImpl::BackgroundFetchServiceImpl( |
| 46 int render_process_id, | 47 int render_process_id, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (title.empty() || title.size() > kMaxTitleLength) { | 192 if (title.empty() || title.size() > kMaxTitleLength) { |
| 192 bad_message::ReceivedBadMessage(render_process_id_, | 193 bad_message::ReceivedBadMessage(render_process_id_, |
| 193 bad_message::BFSI_INVALID_TITLE); | 194 bad_message::BFSI_INVALID_TITLE); |
| 194 return false; | 195 return false; |
| 195 } | 196 } |
| 196 | 197 |
| 197 return true; | 198 return true; |
| 198 } | 199 } |
| 199 | 200 |
| 200 } // namespace content | 201 } // namespace content |
| OLD | NEW |