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