OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "ui/app_list/cocoa/apps_search_box_controller.h" | 5 #import "ui/app_list/cocoa/apps_search_box_controller.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 namespace app_list { | 46 namespace app_list { |
47 | 47 |
48 class SearchBoxModelObserverBridge : public SearchBoxModelObserver { | 48 class SearchBoxModelObserverBridge : public SearchBoxModelObserver { |
49 public: | 49 public: |
50 SearchBoxModelObserverBridge(AppsSearchBoxController* parent); | 50 SearchBoxModelObserverBridge(AppsSearchBoxController* parent); |
51 virtual ~SearchBoxModelObserverBridge(); | 51 virtual ~SearchBoxModelObserverBridge(); |
52 | 52 |
53 void SetSearchText(const base::string16& text); | 53 void SetSearchText(const base::string16& text); |
54 | 54 |
55 virtual void IconChanged() OVERRIDE; | 55 virtual void IconChanged() OVERRIDE; |
| 56 virtual void SpeechRecognitionButtonPropChanged() OVERRIDE; |
| 57 virtual void SetSpeechRecognitionButtonState(bool toggled) OVERRIDE; |
56 virtual void HintTextChanged() OVERRIDE; | 58 virtual void HintTextChanged() OVERRIDE; |
57 virtual void SelectionModelChanged() OVERRIDE; | 59 virtual void SelectionModelChanged() OVERRIDE; |
58 virtual void TextChanged() OVERRIDE; | 60 virtual void TextChanged() OVERRIDE; |
59 | 61 |
60 private: | 62 private: |
61 SearchBoxModel* GetModel(); | 63 SearchBoxModel* GetModel(); |
62 | 64 |
63 AppsSearchBoxController* parent_; // Weak. Owns us. | 65 AppsSearchBoxController* parent_; // Weak. Owns us. |
64 | 66 |
65 DISALLOW_COPY_AND_ASSIGN(SearchBoxModelObserverBridge); | 67 DISALLOW_COPY_AND_ASSIGN(SearchBoxModelObserverBridge); |
(...skipping 23 matching lines...) Expand all Loading... |
89 model->SetText(text); | 91 model->SetText(text); |
90 // TODO(tapted): See if this should call SetSelectionModel here. | 92 // TODO(tapted): See if this should call SetSelectionModel here. |
91 model->AddObserver(this); | 93 model->AddObserver(this); |
92 } | 94 } |
93 | 95 |
94 void SearchBoxModelObserverBridge::IconChanged() { | 96 void SearchBoxModelObserverBridge::IconChanged() { |
95 [[parent_ searchImageView] setImage:gfx::NSImageFromImageSkiaWithColorSpace( | 97 [[parent_ searchImageView] setImage:gfx::NSImageFromImageSkiaWithColorSpace( |
96 GetModel()->icon(), base::mac::GetSRGBColorSpace())]; | 98 GetModel()->icon(), base::mac::GetSRGBColorSpace())]; |
97 } | 99 } |
98 | 100 |
| 101 void SearchBoxModelObserverBridge::SpeechRecognitionButtonPropChanged() { |
| 102 // TODO(mukai): implement. |
| 103 NOTIMPLEMENTED(); |
| 104 } |
| 105 |
| 106 void SearchBoxModelObserverBridge::SetSpeechRecognitionButtonState( |
| 107 bool toggled) { |
| 108 // TODO(mukai): implement. |
| 109 NOTIMPLEMENTED(); |
| 110 } |
| 111 |
99 void SearchBoxModelObserverBridge::HintTextChanged() { | 112 void SearchBoxModelObserverBridge::HintTextChanged() { |
100 [[[parent_ searchTextField] cell] setPlaceholderString: | 113 [[[parent_ searchTextField] cell] setPlaceholderString: |
101 base::SysUTF16ToNSString(GetModel()->hint_text())]; | 114 base::SysUTF16ToNSString(GetModel()->hint_text())]; |
102 } | 115 } |
103 | 116 |
104 void SearchBoxModelObserverBridge::SelectionModelChanged() { | 117 void SearchBoxModelObserverBridge::SelectionModelChanged() { |
105 // TODO(tapted): See if anything needs to be done here for RTL. | 118 // TODO(tapted): See if anything needs to be done here for RTL. |
106 } | 119 } |
107 | 120 |
108 void SearchBoxModelObserverBridge::TextChanged() { | 121 void SearchBoxModelObserverBridge::TextChanged() { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( | 394 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( |
382 NSMaxX(anchorRect) + kMenuXOffsetFromButton, | 395 NSMaxX(anchorRect) + kMenuXOffsetFromButton, |
383 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; | 396 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; |
384 NSRect confinementRect = [[menuButton window] frame]; | 397 NSRect confinementRect = [[menuButton window] frame]; |
385 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), | 398 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), |
386 anchorPoint.y - NSMinY(confinementRect)); | 399 anchorPoint.y - NSMinY(confinementRect)); |
387 return confinementRect; | 400 return confinementRect; |
388 } | 401 } |
389 | 402 |
390 @end | 403 @end |
OLD | NEW |