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 4c724b1c1914dd00547042a6ae5a6a936a29c718..96fb1f23422e2dc0763084848436b7a6811461fc 100644 |
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
@@ -40,6 +40,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" |
@@ -179,6 +180,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(); |
} |
//////////////////////////////////////////////////////////////////////////////// |
@@ -188,6 +197,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()) && |
@@ -749,7 +769,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); |
@@ -769,6 +789,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, |