| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/contextualsearch/contextual_search_delegate.h" | 5 #include "chrome/browser/android/contextualsearch/contextual_search_delegate.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 if (!is_default_search_provider_google) | 405 if (!is_default_search_provider_google) |
| 406 return false; | 406 return false; |
| 407 | 407 |
| 408 // Only allow HTTP URLs or HTTPS URLs. | 408 // Only allow HTTP URLs or HTTPS URLs. |
| 409 if (current_page_url.scheme() != url::kHttpScheme && | 409 if (current_page_url.scheme() != url::kHttpScheme && |
| 410 (current_page_url.scheme() != url::kHttpsScheme)) | 410 (current_page_url.scheme() != url::kHttpsScheme)) |
| 411 return false; | 411 return false; |
| 412 | 412 |
| 413 // Check that the user has sync enabled, is logged in, and syncs their Chrome | 413 // Check that the user has sync enabled, is logged in, and syncs their Chrome |
| 414 // History. | 414 // History. |
| 415 ProfileSyncService* service = | 415 browser_sync::ProfileSyncService* service = |
| 416 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 416 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
| 417 sync_driver::SyncPrefs sync_prefs(profile->GetPrefs()); | 417 sync_driver::SyncPrefs sync_prefs(profile->GetPrefs()); |
| 418 if (service == NULL || !service->CanSyncStart() || | 418 if (service == NULL || !service->CanSyncStart() || |
| 419 !sync_prefs.GetPreferredDataTypes(syncer::UserTypes()) | 419 !sync_prefs.GetPreferredDataTypes(syncer::UserTypes()) |
| 420 .Has(syncer::PROXY_TABS) || | 420 .Has(syncer::PROXY_TABS) || |
| 421 !service->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES)) { | 421 !service->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES)) { |
| 422 return false; | 422 return false; |
| 423 } | 423 } |
| 424 | 424 |
| 425 return true; | 425 return true; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 const base::DictionaryValue* single_card = nullptr; | 572 const base::DictionaryValue* single_card = nullptr; |
| 573 if (!card_dict->GetDictionary(kContextualSearchSingleCard, &single_card)) | 573 if (!card_dict->GetDictionary(kContextualSearchSingleCard, &single_card)) |
| 574 continue; | 574 continue; |
| 575 | 575 |
| 576 DCHECK(single_card); | 576 DCHECK(single_card); |
| 577 single_card->GetString(kContextualSearchSubTitle, subtitle); | 577 single_card->GetString(kContextualSearchSubTitle, subtitle); |
| 578 single_card->GetString(kContextualSearchThumbnailUri, thumbnail); | 578 single_card->GetString(kContextualSearchThumbnailUri, thumbnail); |
| 579 return; | 579 return; |
| 580 } | 580 } |
| 581 } | 581 } |
| OLD | NEW |