| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/webshare/share_service_impl.h" | 5 #include "chrome/browser/webshare/share_service_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 bool IsIdentifier(char c) { | 28 bool IsIdentifier(char c) { |
| 29 return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) || c == '-' || c == '_'; | 29 return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) || c == '-' || c == '_'; |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 ShareServiceImpl::ShareServiceImpl() : weak_factory_(this) {} | 34 ShareServiceImpl::ShareServiceImpl() : weak_factory_(this) {} |
| 35 ShareServiceImpl::~ShareServiceImpl() = default; | 35 ShareServiceImpl::~ShareServiceImpl() = default; |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 void ShareServiceImpl::Create(blink::mojom::ShareServiceRequest request) { | 38 void ShareServiceImpl::Create( |
| 39 const service_manager::BindSourceInfo& source_info, |
| 40 blink::mojom::ShareServiceRequest request) { |
| 39 mojo::MakeStrongBinding(base::MakeUnique<ShareServiceImpl>(), | 41 mojo::MakeStrongBinding(base::MakeUnique<ShareServiceImpl>(), |
| 40 std::move(request)); | 42 std::move(request)); |
| 41 } | 43 } |
| 42 | 44 |
| 43 // static | 45 // static |
| 44 bool ShareServiceImpl::ReplacePlaceholders(base::StringPiece url_template, | 46 bool ShareServiceImpl::ReplacePlaceholders(base::StringPiece url_template, |
| 45 base::StringPiece title, | 47 base::StringPiece title, |
| 46 base::StringPiece text, | 48 base::StringPiece text, |
| 47 const GURL& share_url, | 49 const GURL& share_url, |
| 48 std::string* url_template_filled) { | 50 std::string* url_template_filled) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // - The base URL: can't be invalid since it's derived from the manifest URL. | 228 // - The base URL: can't be invalid since it's derived from the manifest URL. |
| 227 // - The template: can only be invalid if it contains a NUL character or | 229 // - The template: can only be invalid if it contains a NUL character or |
| 228 // invalid UTF-8 sequence (which it can't have). | 230 // invalid UTF-8 sequence (which it can't have). |
| 229 // - The replaced pieces: these are escaped. | 231 // - The replaced pieces: these are escaped. |
| 230 // If somehow we slip through this DCHECK, it will just open about:blank. | 232 // If somehow we slip through this DCHECK, it will just open about:blank. |
| 231 DCHECK(target.is_valid()); | 233 DCHECK(target.is_valid()); |
| 232 OpenTargetURL(target); | 234 OpenTargetURL(target); |
| 233 | 235 |
| 234 callback.Run(blink::mojom::ShareError::OK); | 236 callback.Run(blink::mojom::ShareError::OK); |
| 235 } | 237 } |
| OLD | NEW |