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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 56 virtual void SpeechRecognitionButtonPropChanged() OVERRIDE; |
57 virtual void SetSpeechRecognitionButtonState(bool toggled) OVERRIDE; | |
58 virtual void HintTextChanged() OVERRIDE; | 57 virtual void HintTextChanged() OVERRIDE; |
59 virtual void SelectionModelChanged() OVERRIDE; | 58 virtual void SelectionModelChanged() OVERRIDE; |
60 virtual void TextChanged() OVERRIDE; | 59 virtual void TextChanged() OVERRIDE; |
61 | 60 |
62 private: | 61 private: |
63 SearchBoxModel* GetModel(); | 62 SearchBoxModel* GetModel(); |
64 | 63 |
65 AppsSearchBoxController* parent_; // Weak. Owns us. | 64 AppsSearchBoxController* parent_; // Weak. Owns us. |
66 | 65 |
67 DISALLOW_COPY_AND_ASSIGN(SearchBoxModelObserverBridge); | 66 DISALLOW_COPY_AND_ASSIGN(SearchBoxModelObserverBridge); |
(...skipping 28 matching lines...) Expand all Loading... |
96 void SearchBoxModelObserverBridge::IconChanged() { | 95 void SearchBoxModelObserverBridge::IconChanged() { |
97 [[parent_ searchImageView] setImage:gfx::NSImageFromImageSkiaWithColorSpace( | 96 [[parent_ searchImageView] setImage:gfx::NSImageFromImageSkiaWithColorSpace( |
98 GetModel()->icon(), base::mac::GetSRGBColorSpace())]; | 97 GetModel()->icon(), base::mac::GetSRGBColorSpace())]; |
99 } | 98 } |
100 | 99 |
101 void SearchBoxModelObserverBridge::SpeechRecognitionButtonPropChanged() { | 100 void SearchBoxModelObserverBridge::SpeechRecognitionButtonPropChanged() { |
102 // TODO(mukai): implement. | 101 // TODO(mukai): implement. |
103 NOTIMPLEMENTED(); | 102 NOTIMPLEMENTED(); |
104 } | 103 } |
105 | 104 |
106 void SearchBoxModelObserverBridge::SetSpeechRecognitionButtonState( | |
107 bool toggled) { | |
108 // TODO(mukai): implement. | |
109 NOTIMPLEMENTED(); | |
110 } | |
111 | |
112 void SearchBoxModelObserverBridge::HintTextChanged() { | 105 void SearchBoxModelObserverBridge::HintTextChanged() { |
113 [[[parent_ searchTextField] cell] setPlaceholderString: | 106 [[[parent_ searchTextField] cell] setPlaceholderString: |
114 base::SysUTF16ToNSString(GetModel()->hint_text())]; | 107 base::SysUTF16ToNSString(GetModel()->hint_text())]; |
115 } | 108 } |
116 | 109 |
117 void SearchBoxModelObserverBridge::SelectionModelChanged() { | 110 void SearchBoxModelObserverBridge::SelectionModelChanged() { |
118 // TODO(tapted): See if anything needs to be done here for RTL. | 111 // TODO(tapted): See if anything needs to be done here for RTL. |
119 } | 112 } |
120 | 113 |
121 void SearchBoxModelObserverBridge::TextChanged() { | 114 void SearchBoxModelObserverBridge::TextChanged() { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( | 387 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( |
395 NSMaxX(anchorRect) + kMenuXOffsetFromButton, | 388 NSMaxX(anchorRect) + kMenuXOffsetFromButton, |
396 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; | 389 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; |
397 NSRect confinementRect = [[menuButton window] frame]; | 390 NSRect confinementRect = [[menuButton window] frame]; |
398 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), | 391 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), |
399 anchorPoint.y - NSMinY(confinementRect)); | 392 anchorPoint.y - NSMinY(confinementRect)); |
400 return confinementRect; | 393 return confinementRect; |
401 } | 394 } |
402 | 395 |
403 @end | 396 @end |
OLD | NEW |