| 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/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 11 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 12 #include "chrome/browser/autocomplete/autocomplete_match.h" | 12 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 13 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 14 #include "chrome/browser/command_updater.h" | 14 #include "chrome/browser/command_updater.h" |
| 15 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" | 15 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" |
| 16 #include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents
_view.h" | 16 #include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents
_view.h" |
| 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 18 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "content/common/notification_service.h" | 20 #include "content/common/notification_service.h" |
| 20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 22 #include "net/base/escape.h" | 23 #include "net/base/escape.h" |
| 23 #include "third_party/skia/include/core/SkColor.h" | 24 #include "third_party/skia/include/core/SkColor.h" |
| 24 #include "ui/base/accessibility/accessible_view_state.h" | 25 #include "ui/base/accessibility/accessible_view_state.h" |
| 25 #include "ui/base/dragdrop/drag_drop_types.h" | 26 #include "ui/base/dragdrop/drag_drop_types.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 delete_at_end_pressed_(false), | 138 delete_at_end_pressed_(false), |
| 138 faded_text_style_(NULL), | 139 faded_text_style_(NULL), |
| 139 normal_text_style_(NULL), | 140 normal_text_style_(NULL), |
| 140 security_error_scheme_style_(NULL), | 141 security_error_scheme_style_(NULL), |
| 141 secure_scheme_style_(NULL) { | 142 secure_scheme_style_(NULL) { |
| 142 set_border(views::Border::CreateEmptyBorder(kAutocompleteVerticalMargin, 0, | 143 set_border(views::Border::CreateEmptyBorder(kAutocompleteVerticalMargin, 0, |
| 143 kAutocompleteVerticalMargin, 0)); | 144 kAutocompleteVerticalMargin, 0)); |
| 144 } | 145 } |
| 145 | 146 |
| 146 OmniboxViewViews::~OmniboxViewViews() { | 147 OmniboxViewViews::~OmniboxViewViews() { |
| 147 NotificationService::current()->Notify(NotificationType::OMNIBOX_DESTROYED, | 148 NotificationService::current()->Notify( |
| 148 Source<OmniboxViewViews>(this), | 149 chrome::NOTIFICATION_OMNIBOX_DESTROYED, Source<OmniboxViewViews>(this), |
| 149 NotificationService::NoDetails()); | 150 NotificationService::NoDetails()); |
| 150 // Explicitly teardown members which have a reference to us. Just to be safe | 151 // Explicitly teardown members which have a reference to us. Just to be safe |
| 151 // we want them to be destroyed before destroying any other internal state. | 152 // we want them to be destroyed before destroying any other internal state. |
| 152 popup_view_.reset(); | 153 popup_view_.reset(); |
| 153 model_.reset(); | 154 model_.reset(); |
| 154 } | 155 } |
| 155 | 156 |
| 156 //////////////////////////////////////////////////////////////////////////////// | 157 //////////////////////////////////////////////////////////////////////////////// |
| 157 // OmniboxViewViews public: | 158 // OmniboxViewViews public: |
| 158 | 159 |
| 159 void OmniboxViewViews::Init() { | 160 void OmniboxViewViews::Init() { |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 } | 558 } |
| 558 | 559 |
| 559 int OmniboxViewViews::OnPerformDrop(const views::DropTargetEvent& event) { | 560 int OmniboxViewViews::OnPerformDrop(const views::DropTargetEvent& event) { |
| 560 NOTIMPLEMENTED(); | 561 NOTIMPLEMENTED(); |
| 561 return ui::DragDropTypes::DRAG_NONE; | 562 return ui::DragDropTypes::DRAG_NONE; |
| 562 } | 563 } |
| 563 | 564 |
| 564 //////////////////////////////////////////////////////////////////////////////// | 565 //////////////////////////////////////////////////////////////////////////////// |
| 565 // OmniboxViewViews, NotificationObserver implementation: | 566 // OmniboxViewViews, NotificationObserver implementation: |
| 566 | 567 |
| 567 void OmniboxViewViews::Observe(NotificationType type, | 568 void OmniboxViewViews::Observe(int type, |
| 568 const NotificationSource& source, | 569 const NotificationSource& source, |
| 569 const NotificationDetails& details) { | 570 const NotificationDetails& details) { |
| 570 DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); | 571 DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); |
| 571 SetBaseColor(); | 572 SetBaseColor(); |
| 572 } | 573 } |
| 573 | 574 |
| 574 //////////////////////////////////////////////////////////////////////////////// | 575 //////////////////////////////////////////////////////////////////////////////// |
| 575 // OmniboxViewViews, views::TextfieldController implementation: | 576 // OmniboxViewViews, views::TextfieldController implementation: |
| 576 | 577 |
| 577 void OmniboxViewViews::ContentsChanged(views::Textfield* sender, | 578 void OmniboxViewViews::ContentsChanged(views::Textfield* sender, |
| 578 const string16& new_contents) { | 579 const string16& new_contents) { |
| 579 } | 580 } |
| 580 | 581 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 normal_text_style_ = textfield_->CreateTextStyle(); | 706 normal_text_style_ = textfield_->CreateTextStyle(); |
| 706 security_error_scheme_style_ = textfield_->CreateTextStyle(); | 707 security_error_scheme_style_ = textfield_->CreateTextStyle(); |
| 707 secure_scheme_style_ = textfield_->CreateTextStyle(); | 708 secure_scheme_style_ = textfield_->CreateTextStyle(); |
| 708 | 709 |
| 709 faded_text_style_->set_foreground(kFadedTextColor); | 710 faded_text_style_->set_foreground(kFadedTextColor); |
| 710 normal_text_style_->set_foreground(kNormalTextColor); | 711 normal_text_style_->set_foreground(kNormalTextColor); |
| 711 secure_scheme_style_->set_foreground(kSecureSchemeColor); | 712 secure_scheme_style_->set_foreground(kSecureSchemeColor); |
| 712 security_error_scheme_style_->set_foreground(kSecurityErrorSchemeColor); | 713 security_error_scheme_style_->set_foreground(kSecurityErrorSchemeColor); |
| 713 security_error_scheme_style_->set_strike(true); | 714 security_error_scheme_style_->set_strike(true); |
| 714 } | 715 } |
| OLD | NEW |