Chromium Code Reviews| 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/bookmarks/browser/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 |
| 18 namespace enhanced_bookmarks { | 17 namespace enhanced_bookmarks { |
| 19 | 18 |
| 20 BookmarkServerSearchService::BookmarkServerSearchService( | 19 BookmarkServerSearchService::BookmarkServerSearchService( |
| 21 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 20 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 22 ProfileOAuth2TokenService* token_service, | 21 ProfileOAuth2TokenService* token_service, |
| 23 SigninManagerBase* signin_manager, | 22 SigninManagerBase* signin_manager, |
| 24 BookmarkModel* bookmark_model) | 23 EnhancedBookmarkModel* enhanced_bookmark_model) |
| 25 : BookmarkServerService(request_context_getter, | 24 : BookmarkServerService(request_context_getter, |
| 26 token_service, | 25 token_service, |
| 27 signin_manager, | 26 signin_manager, |
| 28 bookmark_model) { | 27 enhanced_bookmark_model) { |
| 29 } | 28 } |
| 30 | 29 |
| 31 BookmarkServerSearchService::~BookmarkServerSearchService() { | 30 BookmarkServerSearchService::~BookmarkServerSearchService() { |
| 32 } | 31 } |
| 33 | 32 |
| 34 void BookmarkServerSearchService::Search(const std::string& query) { | 33 void BookmarkServerSearchService::Search(const std::string& query) { |
| 35 DCHECK(query.length()); | 34 DCHECK(query.length()); |
| 36 current_query_ = query; | 35 current_query_ = query; |
| 37 TriggerTokenRequest(true); | 36 TriggerTokenRequest(true); |
| 38 } | 37 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 current_query_.clear(); | 93 current_query_.clear(); |
| 95 return true; | 94 return true; |
| 96 } | 95 } |
| 97 | 96 |
| 98 void BookmarkServerSearchService::CleanAfterFailure() { | 97 void BookmarkServerSearchService::CleanAfterFailure() { |
| 99 searches_.clear(); | 98 searches_.clear(); |
| 100 } | 99 } |
| 101 | 100 |
| 102 void BookmarkServerSearchService::BookmarkNodeAdded(BookmarkModel* model, | 101 void BookmarkServerSearchService::BookmarkNodeAdded(BookmarkModel* model, |
| 103 const BookmarkNode* parent, | 102 const BookmarkNode* parent, |
| 104 int index) { | 103 int index) { |
|
noyau (Ping after 24h)
2014/09/17 08:24:35
The superclass used to register for bookmark model
Rune Fevang
2014/09/17 22:51:04
Oops! Put the inheritance back in the superclass s
noyau (Ping after 24h)
2014/09/18 08:43:21
If one register for the model notification and do
Rune Fevang
2014/09/19 01:18:07
Hmm, I think there's an additional issue with the
| |
| 105 BookmarkServerService::BookmarkNodeAdded(model, parent, index); | |
| 106 searches_.clear(); | 104 searches_.clear(); |
| 107 } | 105 } |
| 108 | 106 |
| 109 void BookmarkServerSearchService::BookmarkMetaInfoChanged( | 107 void BookmarkServerSearchService::BookmarkMetaInfoChanged( |
| 110 BookmarkModel* model, | 108 BookmarkModel* model, |
| 111 const BookmarkNode* node) { | 109 const BookmarkNode* node) { |
| 112 BookmarkServerService::BookmarkMetaInfoChanged(model, node); | |
| 113 searches_.clear(); | 110 searches_.clear(); |
|
noyau (Ping after 24h)
2014/09/18 08:43:21
In this case you're right, just swapping the id wo
| |
| 114 } | 111 } |
| 115 } // namespace enhanced_bookmarks | 112 } // namespace enhanced_bookmarks |
| OLD | NEW |