Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: components/enhanced_bookmarks/bookmark_server_search_service.cc

Issue 641473002: Revert of Bring up of the enhanced bookmarks cluster service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@intermediary2
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
8 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h" 7 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h"
9 #include "components/enhanced_bookmarks/proto/search.pb.h" 8 #include "components/enhanced_bookmarks/proto/search.pb.h"
10 #include "net/base/url_util.h" 9 #include "net/base/url_util.h"
11 #include "net/url_request/url_fetcher.h" 10 #include "net/url_request/url_fetcher.h"
12 11
13 namespace { 12 namespace {
14 const std::string kSearchUrl( 13 const std::string kSearchUrl(
15 "https://www.google.com/stars/search"); 14 "https://www.google.com/stars/search");
16 } // namespace 15 } // namespace
17 16
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 for (std::vector<std::string>::iterator clip_it = it->second.begin(); 49 for (std::vector<std::string>::iterator clip_it = it->second.begin();
51 clip_it != it->second.end(); 50 clip_it != it->second.end();
52 ++clip_it) { 51 ++clip_it) {
53 const BookmarkNode* node = BookmarkForRemoteId(*clip_it); 52 const BookmarkNode* node = BookmarkForRemoteId(*clip_it);
54 if (node) 53 if (node)
55 result.push_back(node); 54 result.push_back(node);
56 } 55 }
57 return result; 56 return result;
58 } 57 }
59 58
60 scoped_ptr<net::URLFetcher> BookmarkServerSearchService::CreateFetcher() { 59 net::URLFetcher* BookmarkServerSearchService::CreateFetcher() {
61 // Add the necessary arguments to the URI. 60 // Add the necessary arguments to the URI.
62 GURL url(kSearchUrl); 61 GURL url(kSearchUrl);
63 url = net::AppendQueryParameter(url, "output", "proto"); 62 url = net::AppendQueryParameter(url, "output", "proto");
64 url = net::AppendQueryParameter(url, "q", current_query_); 63 url = net::AppendQueryParameter(url, "q", current_query_);
65 url = net::AppendQueryParameter(url, "v", model_->GetVersionString());
66 64
67 // Build the URLFetcher to perform the request. 65 // Build the URLFetcher to perform the request.
68 scoped_ptr<net::URLFetcher> url_fetcher( 66 net::URLFetcher* url_fetcher =
69 net::URLFetcher::Create(url, net::URLFetcher::GET, this)); 67 net::URLFetcher::Create(url, net::URLFetcher::GET, this);
70 68
71 return url_fetcher; 69 return url_fetcher;
72 } 70 }
73 71
74 bool BookmarkServerSearchService::ProcessResponse(const std::string& response, 72 bool BookmarkServerSearchService::ProcessResponse(const std::string& response,
75 bool* should_notify) { 73 bool* should_notify) {
76 DCHECK(*should_notify); 74 DCHECK(*should_notify);
77 DCHECK(current_query_.length()); 75 DCHECK(current_query_.length());
78 image::collections::CorpusSearchResult response_proto; 76 image::collections::CorpusSearchResult response_proto;
79 bool result = response_proto.ParseFromString(response); 77 bool result = response_proto.ParseFromString(response);
(...skipping 29 matching lines...) Expand all
109 searches_.clear(); 107 searches_.clear();
110 } 108 }
111 109
112 void BookmarkServerSearchService::EnhancedBookmarkRemoteIdChanged( 110 void BookmarkServerSearchService::EnhancedBookmarkRemoteIdChanged(
113 const BookmarkNode* node, 111 const BookmarkNode* node,
114 const std::string& old_remote_id, 112 const std::string& old_remote_id,
115 const std::string& remote_id) { 113 const std::string& remote_id) {
116 searches_.clear(); 114 searches_.clear();
117 } 115 }
118 } // namespace enhanced_bookmarks 116 } // namespace enhanced_bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698