| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_edit.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 32 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 33 #include "chrome/browser/search_engines/template_url_service.h" | 33 #include "chrome/browser/search_engines/template_url_service.h" |
| 34 #include "chrome/browser/search_engines/template_url_service_factory.h" | 34 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 35 #include "chrome/browser/ui/browser_list.h" | 35 #include "chrome/browser/ui/browser_list.h" |
| 36 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 36 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 38 #include "chrome/common/chrome_notification_types.h" | 38 #include "chrome/common/chrome_notification_types.h" |
| 39 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 40 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
| 41 #include "content/browser/user_metrics.h" | 41 #include "content/browser/user_metrics.h" |
| 42 #include "content/common/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 43 #include "googleurl/src/gurl.h" | 43 #include "googleurl/src/gurl.h" |
| 44 #include "googleurl/src/url_util.h" | 44 #include "googleurl/src/url_util.h" |
| 45 #include "third_party/skia/include/core/SkBitmap.h" | 45 #include "third_party/skia/include/core/SkBitmap.h" |
| 46 | 46 |
| 47 /////////////////////////////////////////////////////////////////////////////// | 47 /////////////////////////////////////////////////////////////////////////////// |
| 48 // AutocompleteEditController | 48 // AutocompleteEditController |
| 49 | 49 |
| 50 AutocompleteEditController::~AutocompleteEditController() { | 50 AutocompleteEditController::~AutocompleteEditController() { |
| 51 } | 51 } |
| 52 | 52 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 // We only care about cases where there is a selection (i.e. the popup is | 493 // We only care about cases where there is a selection (i.e. the popup is |
| 494 // open). | 494 // open). |
| 495 if (popup_->IsOpen()) { | 495 if (popup_->IsOpen()) { |
| 496 AutocompleteLog log(autocomplete_controller_->input().text(), | 496 AutocompleteLog log(autocomplete_controller_->input().text(), |
| 497 autocomplete_controller_->input().type(), | 497 autocomplete_controller_->input().type(), |
| 498 popup_->selected_line(), 0, result()); | 498 popup_->selected_line(), 0, result()); |
| 499 if (index != AutocompletePopupModel::kNoMatch) | 499 if (index != AutocompletePopupModel::kNoMatch) |
| 500 log.selected_index = index; | 500 log.selected_index = index; |
| 501 else if (!has_temporary_text_) | 501 else if (!has_temporary_text_) |
| 502 log.inline_autocompleted_length = inline_autocomplete_text_.length(); | 502 log.inline_autocompleted_length = inline_autocomplete_text_.length(); |
| 503 NotificationService::current()->Notify( | 503 content::NotificationService::current()->Notify( |
| 504 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 504 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 505 content::Source<Profile>(profile_), | 505 content::Source<Profile>(profile_), |
| 506 content::Details<AutocompleteLog>(&log)); | 506 content::Details<AutocompleteLog>(&log)); |
| 507 } | 507 } |
| 508 | 508 |
| 509 TemplateURLService* template_url_service = | 509 TemplateURLService* template_url_service = |
| 510 TemplateURLServiceFactory::GetForProfile(profile_); | 510 TemplateURLServiceFactory::GetForProfile(profile_); |
| 511 if (template_url_service && !keyword.empty()) { | 511 if (template_url_service && !keyword.empty()) { |
| 512 const TemplateURL* const template_url = | 512 const TemplateURL* const template_url = |
| 513 template_url_service->GetTemplateURLForKeyword(keyword); | 513 template_url_service->GetTemplateURLForKeyword(keyword); |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 // static | 1061 // static |
| 1062 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { | 1062 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { |
| 1063 switch (c) { | 1063 switch (c) { |
| 1064 case 0x0020: // Space | 1064 case 0x0020: // Space |
| 1065 case 0x3000: // Ideographic Space | 1065 case 0x3000: // Ideographic Space |
| 1066 return true; | 1066 return true; |
| 1067 default: | 1067 default: |
| 1068 return false; | 1068 return false; |
| 1069 } | 1069 } |
| 1070 } | 1070 } |
| OLD | NEW |