Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
|
Matt Giuca
2016/12/21 07:13:49
CL Description:
1. The title is misleading since
constantina
2017/01/04 07:01:45
Done.
| |
| 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 #ifndef CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ |
| 6 #define CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | |
| 10 #include "mojo/public/cpp/bindings/interface_request.h" | 11 #include "mojo/public/cpp/bindings/interface_request.h" |
| 11 #include "third_party/WebKit/public/platform/modules/webshare/webshare.mojom.h" | 12 #include "third_party/WebKit/public/platform/modules/webshare/webshare.mojom.h" |
| 12 | 13 |
| 13 class GURL; | 14 class GURL; |
| 14 | 15 |
| 15 // Desktop implementation of the ShareService Mojo service. | 16 // Desktop implementation of the ShareService Mojo service. |
| 16 class ShareServiceImpl : public blink::mojom::ShareService { | 17 class ShareServiceImpl : public blink::mojom::ShareService { |
| 17 public: | 18 public: |
| 18 ShareServiceImpl() = default; | 19 ShareServiceImpl() = default; |
| 19 ~ShareServiceImpl() override = default; | 20 ~ShareServiceImpl() override = default; |
| 20 | 21 |
| 21 static void Create(mojo::InterfaceRequest<ShareService> request); | 22 static void Create(mojo::InterfaceRequest<ShareService> request); |
| 22 | 23 |
| 23 void Share(const std::string& title, | 24 void Share(const std::string& title, |
|
Matt Giuca
2016/12/21 07:13:49
Add a comment:
// ShareService overrides:
(By con
constantina
2017/01/04 07:01:44
Done. The following example I found had the full n
| |
| 24 const std::string& text, | 25 const std::string& text, |
| 25 const GURL& url, | 26 const GURL& share_url, |
|
Matt Giuca
2016/12/21 07:13:49
Why not just |url|?
constantina
2017/01/04 07:01:45
The implementation references lots of different ty
Matt Giuca
2017/01/05 03:09:24
Right, makes sense. But you should not change the
| |
| 26 const ShareCallback& callback) override; | 27 const ShareCallback& callback) override; |
| 27 | 28 |
| 29 virtual void openTargetURL(GURL target_url); | |
|
Matt Giuca
2016/12/21 07:13:49
nit: Names should start with a capital letter.
Th
constantina
2017/01/04 07:01:44
Done.
| |
| 30 | |
| 28 private: | 31 private: |
| 32 FRIEND_TEST_ALL_PREFIXES(ShareServiceImplUnittest, ReplacePlaceholders); | |
|
Matt Giuca
2016/12/21 07:13:49
👍
constantina
2017/01/04 07:01:44
👍
| |
| 33 FRIEND_TEST_ALL_PREFIXES(ShareServiceImplUnittest, | |
| 34 ReplacePlaceholdersInQuery); | |
| 35 | |
| 36 // Replaces all instances of "%{title}", "%{text}", and "%{url}" (quotes for | |
| 37 // clarity) in |url_template| with |title|, |text|, and |url| respectively. | |
| 38 static std::string replacePlaceholders(const std::string url_template, | |
|
Sam McNally
2016/12/22 07:03:50
ReplacePlaceholders
base::StringPiece
constantina
2017/01/04 07:01:45
Changed Capitalisation. Did you want me to change
| |
| 39 const std::string title, | |
| 40 const std::string text, | |
| 41 const GURL& share_url); | |
| 42 | |
| 29 DISALLOW_COPY_AND_ASSIGN(ShareServiceImpl); | 43 DISALLOW_COPY_AND_ASSIGN(ShareServiceImpl); |
| 30 }; | 44 }; |
| 31 | 45 |
| 32 #endif // CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ | 46 #endif // CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ |
| OLD | NEW |