OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | |
6 #define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | |
7 | |
8 #include <string> | |
9 | |
10 class BookmarkModel; | |
11 class BookmarkNode; | |
12 class GURL; | |
13 | |
14 namespace enhanced_bookmarks { | |
15 // Wrapper around BookmarkModel providing utility functions for enhanced | |
16 // bookmarks. | |
17 class EnhancedBookmarkModel { | |
18 public: | |
19 explicit EnhancedBookmarkModel(BookmarkModel* bookmark_model); | |
noyau (Ping after 24h)
2014/08/26 11:17:47
I don't see the value of making this a class. If y
Yaron
2014/08/26 16:55:22
WIth the current state, I agree with Eric. As this
Rune Fevang
2014/08/26 18:47:52
The plan was to make it a KeyedService in a follow
Yaron
2014/08/27 23:32:36
Ok. That seems fine then. It's tricky though in th
Rune Fevang
2014/08/27 23:52:22
I didn't do it straight away because I wasn't sure
Rune Fevang
2014/08/29 01:10:10
Made it a KeyedService like we talked about.
| |
20 ~EnhancedBookmarkModel(); | |
21 | |
22 void Initialize(const std::string& version); | |
noyau (Ping after 24h)
2014/08/26 11:17:47
Having both a constructor and an Initialize is alw
Rune Fevang
2014/08/26 18:47:52
It needs to be settable if we're going to be calli
Yaron
2014/08/27 23:32:36
Well, according to the spec, for mobile clients th
Rune Fevang
2014/08/27 23:52:22
There's no need for the initialized_ member yet, b
Yaron
2014/08/28 00:11:49
If the initialization is handled by this class on
Rune Fevang
2014/08/28 00:30:22
I agree this is where the smarts should be. I'd li
noyau (Ping after 24h)
2014/08/28 08:36:53
The way it is done in a component is usually to ha
Rune Fevang
2014/08/29 01:10:10
I think I understand what you're saying now. Basic
| |
23 | |
24 // Returns the remote id for a bookmark. | |
25 std::string GetRemoteIdForNode(const BookmarkNode* node); | |
26 | |
27 // Sets the description of a bookmark. | |
28 void SetDescriptionForNode(const BookmarkNode* node, | |
29 const std::string& description); | |
30 | |
31 // Returns the description of a bookmark. | |
32 std::string GetDescriptionForNode(const BookmarkNode* node); | |
33 | |
34 // Sets the URL of an image representative of the page. | |
35 // Expects the URL to be valid and not empty. | |
36 // Returns true if the metainfo is successfully populated. | |
37 bool SetOriginalImageForNode(const BookmarkNode* node, | |
38 const GURL& url, | |
39 int width, | |
40 int height); | |
41 | |
42 // Returns the url and dimensions of the original scraped image. | |
43 // Returns true if the out variables are populated, false otherwise. | |
44 bool GetOriginalImageForNode(const BookmarkNode* node, | |
45 GURL* url, | |
46 int* width, | |
47 int* height); | |
48 | |
49 // Returns the url and dimensions of the server provided thumbnail image. | |
50 // Returns true if the out variables are populated, false otherwise. | |
51 bool GetThumbnailImageForNode(const BookmarkNode* node, | |
52 GURL* url, | |
53 int* width, | |
54 int* height); | |
55 | |
56 // Returns a brief server provided synopsis of the bookmarked page. | |
57 // Returns the empty string if the snippet could not be extracted. | |
58 std::string GetSnippetForNode(const BookmarkNode* node); | |
59 | |
60 // Returns the version of the last enhanced bookmark client to change this | |
61 // node. Returns the empty string if the node doesn't have one set. | |
62 std::string GetVersionForNode(const BookmarkNode* node); | |
63 | |
64 private: | |
65 // Generates and sets a remote id for the given bookmark. Returns the id set. | |
66 std::string SetRemoteIdForNode(const BookmarkNode* node); | |
67 | |
68 // Helper method for setting a meta info field on a node. Also updates the | |
69 // version field. | |
70 void SetNodeMetaInfo(const BookmarkNode* node, | |
71 const std::string& field, | |
72 const std::string& value); | |
73 | |
74 BookmarkModel* bookmark_model_; | |
Yaron
2014/08/27 23:32:36
Without this being a keyed service, we run the ris
Rune Fevang
2014/08/27 23:52:22
Acknowledged.
| |
75 bool initialized_; | |
76 std::string version_; | |
77 }; | |
78 | |
79 } // namespace enhanced_bookmarks | |
80 | |
81 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | |
OLD | NEW |