| 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 RightButtonPropChanged() OVERRIDE; |
| 57 virtual void RightButtonStateChanged(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::RightButtonPropChanged() { |
| 102 // TODO(mukai): implement. |
| 103 NOTIMPLEMENTED(); |
| 104 } |
| 105 |
| 106 void SearchBoxModelObserverBridge::RightButtonStateChanged(bool toggled) { |
| 107 // TODO(mukai): implement. |
| 108 NOTIMPLEMENTED(); |
| 109 } |
| 110 |
| 99 void SearchBoxModelObserverBridge::HintTextChanged() { | 111 void SearchBoxModelObserverBridge::HintTextChanged() { |
| 100 [[[parent_ searchTextField] cell] setPlaceholderString: | 112 [[[parent_ searchTextField] cell] setPlaceholderString: |
| 101 base::SysUTF16ToNSString(GetModel()->hint_text())]; | 113 base::SysUTF16ToNSString(GetModel()->hint_text())]; |
| 102 } | 114 } |
| 103 | 115 |
| 104 void SearchBoxModelObserverBridge::SelectionModelChanged() { | 116 void SearchBoxModelObserverBridge::SelectionModelChanged() { |
| 105 // TODO(tapted): See if anything needs to be done here for RTL. | 117 // TODO(tapted): See if anything needs to be done here for RTL. |
| 106 } | 118 } |
| 107 | 119 |
| 108 void SearchBoxModelObserverBridge::TextChanged() { | 120 void SearchBoxModelObserverBridge::TextChanged() { |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( | 393 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( |
| 382 NSMaxX(anchorRect) + kMenuXOffsetFromButton, | 394 NSMaxX(anchorRect) + kMenuXOffsetFromButton, |
| 383 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; | 395 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; |
| 384 NSRect confinementRect = [[menuButton window] frame]; | 396 NSRect confinementRect = [[menuButton window] frame]; |
| 385 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), | 397 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), |
| 386 anchorPoint.y - NSMinY(confinementRect)); | 398 anchorPoint.y - NSMinY(confinementRect)); |
| 387 return confinementRect; | 399 return confinementRect; |
| 388 } | 400 } |
| 389 | 401 |
| 390 @end | 402 @end |
| OLD | NEW |