OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/app_list/views/search_box_view.h" | 5 #include "ui/app_list/views/search_box_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 constexpr int kPadding = 12; | 47 constexpr int kPadding = 12; |
48 constexpr int kInnerPadding = 24; | 48 constexpr int kInnerPadding = 24; |
49 constexpr int kPreferredWidth = 360; | 49 constexpr int kPreferredWidth = 360; |
50 constexpr int kPreferredWidthFullscreen = 544; | 50 constexpr int kPreferredWidthFullscreen = 544; |
51 constexpr int kPreferredHeight = 48; | 51 constexpr int kPreferredHeight = 48; |
52 | 52 |
53 constexpr SkColor kHintTextColor = SkColorSetARGBMacro(0xFF, 0xA0, 0xA0, 0xA0); | 53 constexpr SkColor kHintTextColor = SkColorSetARGBMacro(0xFF, 0xA0, 0xA0, 0xA0); |
54 | 54 |
55 constexpr int kBackgroundBorderCornerRadius = 2; | 55 constexpr int kBackgroundBorderCornerRadius = 2; |
56 constexpr int kBackgroundBorderCornerRadiusFullscreen = 24; | 56 constexpr int kBackgroundBorderCornerRadiusFullscreen = 24; |
57 | |
58 constexpr int kGoogleIconSize = 24; | 57 constexpr int kGoogleIconSize = 24; |
59 constexpr int kMicIconSize = 24; | 58 constexpr int kMicIconSize = 24; |
60 | 59 |
61 // Default color used when wallpaper customized color is not available for | 60 // Default color used when wallpaper customized color is not available for |
62 // searchbox, #000 at 87% opacity. | 61 // searchbox, #000 at 87% opacity. |
63 constexpr SkColor kDefaultSearchboxColor = | 62 constexpr SkColor kDefaultSearchboxColor = |
64 SkColorSetARGBMacro(0xDE, 0x00, 0x00, 0x00); | 63 SkColorSetARGBMacro(0xDE, 0x00, 0x00, 0x00); |
65 | 64 |
66 // A background that paints a solid white rounded rect with a thin grey border. | 65 // A background that paints a solid white rounded rect with a thin grey border. |
67 class SearchBoxBackground : public views::Background { | 66 class SearchBoxBackground : public views::Background { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 void SearchBoxView::NotifyQueryChanged() { | 360 void SearchBoxView::NotifyQueryChanged() { |
362 DCHECK(delegate_); | 361 DCHECK(delegate_); |
363 delegate_->QueryChanged(this); | 362 delegate_->QueryChanged(this); |
364 } | 363 } |
365 | 364 |
366 void SearchBoxView::ContentsChanged(views::Textfield* sender, | 365 void SearchBoxView::ContentsChanged(views::Textfield* sender, |
367 const base::string16& new_contents) { | 366 const base::string16& new_contents) { |
368 UpdateModel(); | 367 UpdateModel(); |
369 view_delegate_->AutoLaunchCanceled(); | 368 view_delegate_->AutoLaunchCanceled(); |
370 NotifyQueryChanged(); | 369 NotifyQueryChanged(); |
371 | 370 if (is_fullscreen_app_list_enabled_) |
372 if (is_fullscreen_app_list_enabled_ && !app_list_view_->is_fullscreen()) { | 371 app_list_view_->SetStateFromSearchBoxView(search_box_->text().empty()); |
373 // If the app list is in the peeking state, switch it to fullscreen. | |
374 app_list_view_->SetState(AppListView::FULLSCREEN); | |
375 } | |
376 } | 372 } |
377 | 373 |
378 bool SearchBoxView::HandleKeyEvent(views::Textfield* sender, | 374 bool SearchBoxView::HandleKeyEvent(views::Textfield* sender, |
379 const ui::KeyEvent& key_event) { | 375 const ui::KeyEvent& key_event) { |
380 if (key_event.type() == ui::ET_KEY_PRESSED) { | 376 if (key_event.type() == ui::ET_KEY_PRESSED) { |
381 if (key_event.key_code() == ui::VKEY_TAB && | 377 if (key_event.key_code() == ui::VKEY_TAB && |
382 focused_view_ != FOCUS_CONTENTS_VIEW && | 378 focused_view_ != FOCUS_CONTENTS_VIEW && |
383 MoveTabFocus(key_event.IsShiftDown())) | 379 MoveTabFocus(key_event.IsShiftDown())) |
384 return true; | 380 return true; |
385 | 381 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 NotifyQueryChanged(); | 489 NotifyQueryChanged(); |
494 } | 490 } |
495 | 491 |
496 void SearchBoxView::OnSpeechRecognitionStateChanged( | 492 void SearchBoxView::OnSpeechRecognitionStateChanged( |
497 SpeechRecognitionState new_state) { | 493 SpeechRecognitionState new_state) { |
498 SpeechRecognitionButtonPropChanged(); | 494 SpeechRecognitionButtonPropChanged(); |
499 SchedulePaint(); | 495 SchedulePaint(); |
500 } | 496 } |
501 | 497 |
502 } // namespace app_list | 498 } // namespace app_list |
OLD | NEW |