Giovanni Ortuño Urquidi | 97f8bd52 | 2017-06-16 04:04:37 | [diff] [blame] | 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 | #ifndef CHROME_BROWSER_WEBSHARE_WEBSHARE_TARGET_H_ |
| 6 | #define CHROME_BROWSER_WEBSHARE_WEBSHARE_TARGET_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "url/gurl.h" |
| 11 | |
| 12 | // Represents a Web Share Target and its attributes. The attributes are usually |
| 13 | // retrieved from the share_target field in the site's manifest. |
| 14 | class WebShareTarget { |
| 15 | public: |
| 16 | WebShareTarget(GURL manifest_url, std::string name, std::string url_template); |
| 17 | ~WebShareTarget(); |
| 18 | |
| 19 | // Move constructor |
| 20 | WebShareTarget(WebShareTarget&& other) = default; |
| 21 | |
| 22 | // Move assigment |
| 23 | WebShareTarget& operator=(WebShareTarget&& other) = default; |
| 24 | |
| 25 | const std::string& name() const { return name_; } |
| 26 | const GURL& manifest_url() const { return manifest_url_; } |
| 27 | // The URL template that contains placeholders to be replaced with shared |
| 28 | // data. |
| 29 | const std::string& url_template() const { return url_template_; } |
| 30 | |
| 31 | bool operator==(const WebShareTarget& other) const; |
| 32 | |
| 33 | private: |
| 34 | GURL manifest_url_; |
| 35 | std::string name_; |
| 36 | std::string url_template_; |
| 37 | |
| 38 | DISALLOW_COPY_AND_ASSIGN(WebShareTarget); |
| 39 | }; |
| 40 | |
| 41 | // Used by gtest to print a readable output on test failures. |
| 42 | std::ostream& operator<<(std::ostream& out, const WebShareTarget& target); |
| 43 | |
| 44 | #endif // CHROME_BROWSER_WEBSHARE_WEBSHARE_TARGET_H_ |