| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list/search/omnibox_provider.h" | 5 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" |
| 6 | 6 |
| 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 8 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // The magic number 1500 is the highest score of an omnibox result. | 84 // The magic number 1500 is the highest score of an omnibox result. |
| 85 // See comments in autocomplete_provider.h. | 85 // See comments in autocomplete_provider.h. |
| 86 set_relevance(match_.relevance / 1500.0); | 86 set_relevance(match_.relevance / 1500.0); |
| 87 | 87 |
| 88 UpdateIcon(); | 88 UpdateIcon(); |
| 89 UpdateTitleAndDetails(); | 89 UpdateTitleAndDetails(); |
| 90 } | 90 } |
| 91 virtual ~OmniboxResult() {} | 91 virtual ~OmniboxResult() {} |
| 92 | 92 |
| 93 // ChromeSearchResult overides: | 93 // ChromeSearchResult overides: |
| 94 virtual void Open(int event_flags) OVERRIDE { | 94 virtual void Open(int event_flags) override { |
| 95 chrome::NavigateParams params(profile_, | 95 chrome::NavigateParams params(profile_, |
| 96 match_.destination_url, | 96 match_.destination_url, |
| 97 match_.transition); | 97 match_.transition); |
| 98 params.disposition = ui::DispositionFromEventFlags(event_flags); | 98 params.disposition = ui::DispositionFromEventFlags(event_flags); |
| 99 chrome::Navigate(¶ms); | 99 chrome::Navigate(¶ms); |
| 100 } | 100 } |
| 101 | 101 |
| 102 virtual void InvokeAction(int action_index, int event_flags) OVERRIDE {} | 102 virtual void InvokeAction(int action_index, int event_flags) override {} |
| 103 | 103 |
| 104 virtual scoped_ptr<ChromeSearchResult> Duplicate() OVERRIDE { | 104 virtual scoped_ptr<ChromeSearchResult> Duplicate() override { |
| 105 return scoped_ptr<ChromeSearchResult>( | 105 return scoped_ptr<ChromeSearchResult>( |
| 106 new OmniboxResult(profile_, autocomplete_controller_, match_)).Pass(); | 106 new OmniboxResult(profile_, autocomplete_controller_, match_)).Pass(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 virtual ChromeSearchResultType GetType() OVERRIDE { | 109 virtual ChromeSearchResultType GetType() override { |
| 110 return OMNIBOX_SEARCH_RESULT; | 110 return OMNIBOX_SEARCH_RESULT; |
| 111 } | 111 } |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 void UpdateIcon() { | 114 void UpdateIcon() { |
| 115 BookmarkModel* bookmark_model = | 115 BookmarkModel* bookmark_model = |
| 116 BookmarkModelFactory::GetForProfile(profile_); | 116 BookmarkModelFactory::GetForProfile(profile_); |
| 117 bool is_bookmarked = | 117 bool is_bookmarked = |
| 118 bookmark_model && bookmark_model->IsBookmarked(match_.destination_url); | 118 bookmark_model && bookmark_model->IsBookmarked(match_.destination_url); |
| 119 int resource_id = is_bookmarked ? | 119 int resource_id = is_bookmarked ? |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 new OmniboxResult(profile_, controller_.get(), *it))); | 182 new OmniboxResult(profile_, controller_.get(), *it))); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 void OmniboxProvider::OnResultChanged(bool default_match_changed) { | 186 void OmniboxProvider::OnResultChanged(bool default_match_changed) { |
| 187 const AutocompleteResult& result = controller_->result(); | 187 const AutocompleteResult& result = controller_->result(); |
| 188 PopulateFromACResult(result); | 188 PopulateFromACResult(result); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace app_list | 191 } // namespace app_list |
| OLD | NEW |