| 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_model.h" |
| 8 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h" | 8 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h" |
| 9 #include "components/enhanced_bookmarks/proto/search.pb.h" | 9 #include "components/enhanced_bookmarks/proto/search.pb.h" |
| 10 #include "net/base/url_util.h" | 10 #include "net/base/url_util.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 scoped_ptr<net::URLFetcher> BookmarkServerSearchService::CreateFetcher() { | 71 scoped_ptr<net::URLFetcher> BookmarkServerSearchService::CreateFetcher() { |
| 72 // Add the necessary arguments to the URI. | 72 // Add the necessary arguments to the URI. |
| 73 GURL url(kSearchUrl); | 73 GURL url(kSearchUrl); |
| 74 url = net::AppendQueryParameter(url, "output", "proto"); | 74 url = net::AppendQueryParameter(url, "output", "proto"); |
| 75 url = net::AppendQueryParameter(url, "q", current_query_); | 75 url = net::AppendQueryParameter(url, "q", current_query_); |
| 76 url = net::AppendQueryParameter(url, "v", model_->GetVersionString()); | 76 url = net::AppendQueryParameter(url, "v", model_->GetVersionString()); |
| 77 | 77 |
| 78 // Build the URLFetcher to perform the request. | 78 // Build the URLFetcher to perform the request. |
| 79 scoped_ptr<net::URLFetcher> url_fetcher( | 79 scoped_ptr<net::URLFetcher> url_fetcher = |
| 80 net::URLFetcher::Create(url, net::URLFetcher::GET, this)); | 80 net::URLFetcher::Create(url, net::URLFetcher::GET, this); |
| 81 | 81 |
| 82 return url_fetcher; | 82 return url_fetcher; |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool BookmarkServerSearchService::ProcessResponse(const std::string& response, | 85 bool BookmarkServerSearchService::ProcessResponse(const std::string& response, |
| 86 bool* should_notify) { | 86 bool* should_notify) { |
| 87 DCHECK(*should_notify); | 87 DCHECK(*should_notify); |
| 88 DCHECK(current_query_.length()); | 88 DCHECK(current_query_.length()); |
| 89 image::collections::CorpusSearchResult response_proto; | 89 image::collections::CorpusSearchResult response_proto; |
| 90 bool result = response_proto.ParseFromString(response); | 90 bool result = response_proto.ParseFromString(response); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 118 cache_.Clear(); | 118 cache_.Clear(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void BookmarkServerSearchService::EnhancedBookmarkRemoteIdChanged( | 121 void BookmarkServerSearchService::EnhancedBookmarkRemoteIdChanged( |
| 122 const BookmarkNode* node, | 122 const BookmarkNode* node, |
| 123 const std::string& old_remote_id, | 123 const std::string& old_remote_id, |
| 124 const std::string& remote_id) { | 124 const std::string& remote_id) { |
| 125 cache_.Clear(); | 125 cache_.Clear(); |
| 126 } | 126 } |
| 127 } // namespace enhanced_bookmarks | 127 } // namespace enhanced_bookmarks |
| OLD | NEW |