OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/search/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 omnibox->SetUserText(text_to_paste); | 557 omnibox->SetUserText(text_to_paste); |
558 omnibox->OnAfterPossibleChange(); | 558 omnibox->OnAfterPossibleChange(); |
559 #endif | 559 #endif |
560 } | 560 } |
561 | 561 |
562 void SearchTabHelper::OnChromeIdentityCheck(const base::string16& identity) { | 562 void SearchTabHelper::OnChromeIdentityCheck(const base::string16& identity) { |
563 SigninManagerBase* manager = SigninManagerFactory::GetForProfile(profile()); | 563 SigninManagerBase* manager = SigninManagerFactory::GetForProfile(profile()); |
564 if (manager) { | 564 if (manager) { |
565 const base::string16 username = | 565 const base::string16 username = |
566 base::UTF8ToUTF16(manager->GetAuthenticatedUsername()); | 566 base::UTF8ToUTF16(manager->GetAuthenticatedUsername()); |
567 // The identity check only passes if the user is syncing their history. | 567 ipc_router_.SendChromeIdentityCheckResult(identity, identity == username); |
568 // TODO(beaudoin): Change this function name and related APIs now that it's | |
569 // checking both the identity and the user's sync state. | |
570 bool matches = IsHistorySyncEnabled(profile()) && identity == username; | |
571 ipc_router_.SendChromeIdentityCheckResult(identity, matches); | |
572 } | 568 } |
573 } | 569 } |
574 | 570 |
571 void SearchTabHelper::OnCheckUserSyncHistory() { | |
Mathieu
2014/11/05 13:38:42
OnHistorySyncCheck
beaudoin
2014/11/05 21:28:21
Done.
| |
572 ipc_router_.SendCheckUserSyncHistoryResult( | |
573 IsHistorySyncEnabled(profile())); | |
574 } | |
575 | |
575 void SearchTabHelper::UpdateMode(bool update_origin, bool is_preloaded_ntp) { | 576 void SearchTabHelper::UpdateMode(bool update_origin, bool is_preloaded_ntp) { |
576 SearchMode::Type type = SearchMode::MODE_DEFAULT; | 577 SearchMode::Type type = SearchMode::MODE_DEFAULT; |
577 SearchMode::Origin origin = SearchMode::ORIGIN_DEFAULT; | 578 SearchMode::Origin origin = SearchMode::ORIGIN_DEFAULT; |
578 if (IsNTP(web_contents_) || is_preloaded_ntp) { | 579 if (IsNTP(web_contents_) || is_preloaded_ntp) { |
579 type = SearchMode::MODE_NTP; | 580 type = SearchMode::MODE_NTP; |
580 origin = SearchMode::ORIGIN_NTP; | 581 origin = SearchMode::ORIGIN_NTP; |
581 } else if (IsSearchResults(web_contents_)) { | 582 } else if (IsSearchResults(web_contents_)) { |
582 type = SearchMode::MODE_SEARCH_RESULTS; | 583 type = SearchMode::MODE_SEARCH_RESULTS; |
583 origin = SearchMode::ORIGIN_SEARCH; | 584 origin = SearchMode::ORIGIN_SEARCH; |
584 } | 585 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 | 629 |
629 bool SearchTabHelper::IsInputInProgress() const { | 630 bool SearchTabHelper::IsInputInProgress() const { |
630 OmniboxView* omnibox = GetOmniboxView(); | 631 OmniboxView* omnibox = GetOmniboxView(); |
631 return !model_.mode().is_ntp() && omnibox && | 632 return !model_.mode().is_ntp() && omnibox && |
632 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 633 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
633 } | 634 } |
634 | 635 |
635 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 636 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
636 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 637 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
637 } | 638 } |
OLD | NEW |