OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "components/enhanced_bookmarks/bookmark_server_search_service.h" | 5 #include "components/enhanced_bookmarks/bookmark_server_search_service.h" |
6 | 6 |
| 7 #include "components/enhanced_bookmarks/enhanced_bookmark_model.h" |
7 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h" | 8 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h" |
8 #include "components/enhanced_bookmarks/proto/search.pb.h" | 9 #include "components/enhanced_bookmarks/proto/search.pb.h" |
9 #include "net/base/url_util.h" | 10 #include "net/base/url_util.h" |
10 #include "net/url_request/url_fetcher.h" | 11 #include "net/url_request/url_fetcher.h" |
11 | 12 |
12 namespace { | 13 namespace { |
13 const std::string kSearchUrl( | 14 const std::string kSearchUrl( |
14 "https://www.google.com/stars/search"); | 15 "https://www.google.com/stars/search"); |
15 } // namespace | 16 } // namespace |
16 | 17 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 result.push_back(node); | 55 result.push_back(node); |
55 } | 56 } |
56 return result; | 57 return result; |
57 } | 58 } |
58 | 59 |
59 net::URLFetcher* BookmarkServerSearchService::CreateFetcher() { | 60 net::URLFetcher* BookmarkServerSearchService::CreateFetcher() { |
60 // Add the necessary arguments to the URI. | 61 // Add the necessary arguments to the URI. |
61 GURL url(kSearchUrl); | 62 GURL url(kSearchUrl); |
62 url = net::AppendQueryParameter(url, "output", "proto"); | 63 url = net::AppendQueryParameter(url, "output", "proto"); |
63 url = net::AppendQueryParameter(url, "q", current_query_); | 64 url = net::AppendQueryParameter(url, "q", current_query_); |
| 65 url = net::AppendQueryParameter(url, "v", model_->GetVersionString()); |
64 | 66 |
65 // Build the URLFetcher to perform the request. | 67 // Build the URLFetcher to perform the request. |
66 net::URLFetcher* url_fetcher = | 68 net::URLFetcher* url_fetcher = |
67 net::URLFetcher::Create(url, net::URLFetcher::GET, this); | 69 net::URLFetcher::Create(url, net::URLFetcher::GET, this); |
68 | 70 |
69 return url_fetcher; | 71 return url_fetcher; |
70 } | 72 } |
71 | 73 |
72 bool BookmarkServerSearchService::ProcessResponse(const std::string& response, | 74 bool BookmarkServerSearchService::ProcessResponse(const std::string& response, |
73 bool* should_notify) { | 75 bool* should_notify) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 searches_.clear(); | 109 searches_.clear(); |
108 } | 110 } |
109 | 111 |
110 void BookmarkServerSearchService::EnhancedBookmarkRemoteIdChanged( | 112 void BookmarkServerSearchService::EnhancedBookmarkRemoteIdChanged( |
111 const BookmarkNode* node, | 113 const BookmarkNode* node, |
112 const std::string& old_remote_id, | 114 const std::string& old_remote_id, |
113 const std::string& remote_id) { | 115 const std::string& remote_id) { |
114 searches_.clear(); | 116 searches_.clear(); |
115 } | 117 } |
116 } // namespace enhanced_bookmarks | 118 } // namespace enhanced_bookmarks |
OLD | NEW |