Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
index f01cfb8b184c7f2ae23de3f8beb2efba7d7bfcbf..80b72d55642545602b2b93e49ecbac092ec8befa 100644 |
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
@@ -39,6 +39,7 @@ |
#include "ui/base/models/simple_menu_model.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/events/event.h" |
+#include "ui/gfx/animation/slide_animation.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/font_list.h" |
#include "ui/gfx/selection_model.h" |
@@ -178,6 +179,14 @@ void OmniboxViewViews::Init() { |
chromeos::input_method::InputMethodManager::Get()-> |
AddCandidateWindowObserver(this); |
#endif |
+ |
+ fade_in_animation_.reset(new gfx::SlideAnimation(this)); |
+ fade_in_animation_->SetTweenType(gfx::Tween::LINEAR); |
+ fade_in_animation_->SetSlideDuration(300); |
+} |
+ |
+void OmniboxViewViews::FadeIn() { |
+ fade_in_animation_->Show(); |
} |
//////////////////////////////////////////////////////////////////////////////// |
@@ -187,6 +196,17 @@ const char* OmniboxViewViews::GetClassName() const { |
return kViewClassName; |
} |
+void OmniboxViewViews::OnPaint(gfx::Canvas* canvas) { |
+ if (fade_in_animation_->is_animating()) { |
+ canvas->SaveLayerAlpha(static_cast<uint8>( |
+ fade_in_animation_->CurrentValueBetween(0, 255))); |
+ views::Textfield::OnPaint(canvas); |
+ canvas->Restore(); |
+ } else { |
+ views::Textfield::OnPaint(canvas); |
+ } |
+} |
+ |
bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) { |
select_all_on_mouse_release_ = |
(event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && |
@@ -745,7 +765,7 @@ void OmniboxViewViews::ExecuteCommand(int command_id, int event_flags) { |
model()->PasteAndGo(GetClipboardText()); |
break; |
case IDS_SHOW_URL: |
- ShowURL(); |
+ controller()->ShowURL(); |
break; |
case IDC_EDIT_SEARCH_ENGINES: |
command_updater()->ExecuteCommand(command_id); |
@@ -765,6 +785,17 @@ void OmniboxViewViews::ExecuteCommand(int command_id, int event_flags) { |
} |
//////////////////////////////////////////////////////////////////////////////// |
+// OmniboxViewViews, gfx::AnimationDelegate implementation: |
+ |
+void OmniboxViewViews::AnimationProgressed(const gfx::Animation* animation) { |
+ SchedulePaint(); |
+} |
+ |
+void OmniboxViewViews::AnimationEnded(const gfx::Animation* animation) { |
+ fade_in_animation_->Reset(); |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
// OmniboxViewViews, views::TextfieldController implementation: |
void OmniboxViewViews::ContentsChanged(views::Textfield* sender, |