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

Side by Side Diff: chrome/browser/speech/speech_input_bubble_controller.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/speech/speech_input_bubble_controller.h" 5 #include "chrome/browser/speech/speech_input_bubble_controller.h"
6 6
7 #include "chrome/browser/tab_contents/tab_util.h" 7 #include "chrome/browser/tab_contents/tab_util.h"
8 #include "content/browser/browser_thread.h" 8 #include "content/browser/browser_thread.h"
9 #include "content/browser/tab_contents/tab_contents.h" 9 #include "content/browser/tab_contents/tab_contents.h"
10 #include "content/common/content_notification_types.h"
10 #include "content/common/notification_registrar.h" 11 #include "content/common/notification_registrar.h"
11 #include "content/common/notification_source.h" 12 #include "content/common/notification_source.h"
12 #include "content/common/notification_type.h"
13 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 14
15 namespace speech_input { 15 namespace speech_input {
16 16
17 SpeechInputBubbleController::SpeechInputBubbleController(Delegate* delegate) 17 SpeechInputBubbleController::SpeechInputBubbleController(Delegate* delegate)
18 : delegate_(delegate), 18 : delegate_(delegate),
19 current_bubble_caller_id_(0), 19 current_bubble_caller_id_(0),
20 registrar_(new NotificationRegistrar) { 20 registrar_(new NotificationRegistrar) {
21 } 21 }
22 22
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 iter != bubbles_.end(); ++iter) { 103 iter != bubbles_.end(); ++iter) {
104 if (iter->second->tab_contents() == tab_contents && 104 if (iter->second->tab_contents() == tab_contents &&
105 iter->first != caller_id) { 105 iter->first != caller_id) {
106 // At least one other bubble exists for the same TabContents. So don't 106 // At least one other bubble exists for the same TabContents. So don't
107 // make any change to the subscription. 107 // make any change to the subscription.
108 return; 108 return;
109 } 109 }
110 } 110 }
111 111
112 if (action == BUBBLE_ADDED) { 112 if (action == BUBBLE_ADDED) {
113 registrar_->Add(this, NotificationType::TAB_CONTENTS_DESTROYED, 113 registrar_->Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
114 Source<TabContents>(tab_contents)); 114 Source<TabContents>(tab_contents));
115 } else { 115 } else {
116 registrar_->Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, 116 registrar_->Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
117 Source<TabContents>(tab_contents)); 117 Source<TabContents>(tab_contents));
118 } 118 }
119 } 119 }
120 120
121 void SpeechInputBubbleController::Observe(NotificationType type, 121 void SpeechInputBubbleController::Observe(int type,
122 const NotificationSource& source, 122 const NotificationSource& source,
123 const NotificationDetails& details) { 123 const NotificationDetails& details) {
124 if (type == NotificationType::TAB_CONTENTS_DESTROYED) { 124 if (type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED) {
125 // Cancel all bubbles and active recognition sessions for this tab. 125 // Cancel all bubbles and active recognition sessions for this tab.
126 TabContents* tab_contents = Source<TabContents>(source).ptr(); 126 TabContents* tab_contents = Source<TabContents>(source).ptr();
127 BubbleCallerIdMap::iterator iter = bubbles_.begin(); 127 BubbleCallerIdMap::iterator iter = bubbles_.begin();
128 while (iter != bubbles_.end()) { 128 while (iter != bubbles_.end()) {
129 if (iter->second->tab_contents() == tab_contents) { 129 if (iter->second->tab_contents() == tab_contents) {
130 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 130 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
131 NewRunnableMethod( 131 NewRunnableMethod(
132 this, 132 this,
133 &SpeechInputBubbleController::InvokeDelegateButtonClicked, 133 &SpeechInputBubbleController::InvokeDelegateButtonClicked,
134 iter->first, SpeechInputBubble::BUTTON_CANCEL)); 134 iter->first, SpeechInputBubble::BUTTON_CANCEL));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 void SpeechInputBubbleController::InvokeDelegateButtonClicked( 232 void SpeechInputBubbleController::InvokeDelegateButtonClicked(
233 int caller_id, SpeechInputBubble::Button button) { 233 int caller_id, SpeechInputBubble::Button button) {
234 delegate_->InfoBubbleButtonClicked(caller_id, button); 234 delegate_->InfoBubbleButtonClicked(caller_id, button);
235 } 235 }
236 236
237 void SpeechInputBubbleController::InvokeDelegateFocusChanged(int caller_id) { 237 void SpeechInputBubbleController::InvokeDelegateFocusChanged(int caller_id) {
238 delegate_->InfoBubbleFocusChanged(caller_id); 238 delegate_->InfoBubbleFocusChanged(caller_id);
239 } 239 }
240 240
241 } // namespace speech_input 241 } // namespace speech_input
OLDNEW
« no previous file with comments | « chrome/browser/speech/speech_input_bubble_controller.h ('k') | chrome/browser/spellcheck_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698