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

Side by Side Diff: components/history/core/browser/web_history_service.cc

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/history/core/browser/web_history_service.h" 5 #include "components/history/core/browser/web_history_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 void WebHistoryService::QueryOtherFormsOfBrowsingHistory( 505 void WebHistoryService::QueryOtherFormsOfBrowsingHistory(
506 version_info::Channel channel, 506 version_info::Channel channel,
507 const QueryOtherFormsOfBrowsingHistoryCallback& callback) { 507 const QueryOtherFormsOfBrowsingHistoryCallback& callback) {
508 // Wrap the original callback into a generic completion callback. 508 // Wrap the original callback into a generic completion callback.
509 CompletionCallback completion_callback = base::Bind( 509 CompletionCallback completion_callback = base::Bind(
510 &WebHistoryService::QueryOtherFormsOfBrowsingHistoryCompletionCallback, 510 &WebHistoryService::QueryOtherFormsOfBrowsingHistoryCompletionCallback,
511 weak_ptr_factory_.GetWeakPtr(), 511 weak_ptr_factory_.GetWeakPtr(),
512 callback); 512 callback);
513 513
514 // Find the Sync request URL. 514 // Find the Sync request URL.
515 GURL url = syncer::GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), 515 GURL url =
516 channel); 516 GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), channel);
517 GURL::Replacements replace_path; 517 GURL::Replacements replace_path;
518 std::string new_path = 518 std::string new_path =
519 url.path() + kQueryOtherFormsOfBrowsingHistoryUrlSuffix; 519 url.path() + kQueryOtherFormsOfBrowsingHistoryUrlSuffix;
520 replace_path.SetPathStr(new_path); 520 replace_path.SetPathStr(new_path);
521 url = url.ReplaceComponents(replace_path); 521 url = url.ReplaceComponents(replace_path);
522 DCHECK(url.is_valid()); 522 DCHECK(url.is_valid());
523 523
524 Request* request = CreateRequest(url, completion_callback); 524 Request* request = CreateRequest(url, completion_callback);
525 525
526 // Set the Sync-specific user agent. 526 // Set the Sync-specific user agent.
527 std::string user_agent = syncer::MakeUserAgentForSync( 527 std::string user_agent = MakeUserAgentForSync(
528 channel, ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET); 528 channel, ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET);
529 request->SetUserAgent(user_agent); 529 request->SetUserAgent(user_agent);
530 530
531 pending_other_forms_of_browsing_history_requests_.insert(request); 531 pending_other_forms_of_browsing_history_requests_.insert(request);
532 532
533 // Set the request protobuf. 533 // Set the request protobuf.
534 sync_pb::HistoryStatusRequest request_proto; 534 sync_pb::HistoryStatusRequest request_proto;
535 std::string post_data; 535 std::string post_data;
536 request_proto.SerializeToString(&post_data); 536 request_proto.SerializeToString(&post_data);
537 request->SetPostDataAndType(post_data, kSyncProtoMimeType); 537 request->SetPostDataAndType(post_data, kSyncProtoMimeType);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 if (success && request->GetResponseCode() == net::HTTP_OK) { 625 if (success && request->GetResponseCode() == net::HTTP_OK) {
626 sync_pb::HistoryStatusResponse history_status; 626 sync_pb::HistoryStatusResponse history_status;
627 if (history_status.ParseFromString(request->GetResponseBody())) 627 if (history_status.ParseFromString(request->GetResponseBody()))
628 has_other_forms_of_browsing_history = history_status.has_derived_data(); 628 has_other_forms_of_browsing_history = history_status.has_derived_data();
629 } 629 }
630 630
631 callback.Run(has_other_forms_of_browsing_history); 631 callback.Run(has_other_forms_of_browsing_history);
632 } 632 }
633 633
634 } // namespace history 634 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698