Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: ui/app_list/cocoa/apps_search_box_controller.mm

Issue 69813002: Adds the speech recognition button to the app-list searchbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/app_list/app_list_view_delegate.h ('k') | ui/app_list/search_box_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « ui/app_list/app_list_view_delegate.h ('k') | ui/app_list/search_box_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698