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

Side by Side Diff: chrome/browser/speech/extension_api/tts_engine_extension_api.cc

Issue 671763002: Extract ProcessManager from ExtensionSystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extension_api/tts_engine_extension_api.h" 5 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 void WarnIfMissingPauseOrResumeListener( 48 void WarnIfMissingPauseOrResumeListener(
49 Profile* profile, EventRouter* event_router, std::string extension_id) { 49 Profile* profile, EventRouter* event_router, std::string extension_id) {
50 bool has_onpause = event_router->ExtensionHasEventListener( 50 bool has_onpause = event_router->ExtensionHasEventListener(
51 extension_id, tts_engine_events::kOnPause); 51 extension_id, tts_engine_events::kOnPause);
52 bool has_onresume = event_router->ExtensionHasEventListener( 52 bool has_onresume = event_router->ExtensionHasEventListener(
53 extension_id, tts_engine_events::kOnResume); 53 extension_id, tts_engine_events::kOnResume);
54 if (has_onpause == has_onresume) 54 if (has_onpause == has_onresume)
55 return; 55 return;
56 56
57 extensions::ProcessManager* process_manager =
58 ExtensionSystem::Get(profile)->process_manager();
59 extensions::ExtensionHost* host = 57 extensions::ExtensionHost* host =
60 process_manager->GetBackgroundHostForExtension(extension_id); 58 extensions::ProcessManager::Get(profile)
59 ->GetBackgroundHostForExtension(extension_id);
61 host->render_process_host()->Send(new ExtensionMsg_AddMessageToConsole( 60 host->render_process_host()->Send(new ExtensionMsg_AddMessageToConsole(
62 host->render_view_host()->GetRoutingID(), 61 host->render_view_host()->GetRoutingID(),
63 content::CONSOLE_MESSAGE_LEVEL_WARNING, 62 content::CONSOLE_MESSAGE_LEVEL_WARNING,
64 constants::kErrorMissingPauseOrResume)); 63 constants::kErrorMissingPauseOrResume));
65 } 64 }
66 65
67 } // namespace 66 } // namespace
68 67
69 TtsExtensionEngine* TtsExtensionEngine::GetInstance() { 68 TtsExtensionEngine* TtsExtensionEngine::GetInstance() {
70 return Singleton<TtsExtensionEngine>::get(); 69 return Singleton<TtsExtensionEngine>::get();
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); 302 utterance_id, TTS_EVENT_PAUSE, char_index, std::string());
304 } else if (event_type == constants::kEventTypeResume) { 303 } else if (event_type == constants::kEventTypeResume) {
305 controller->OnTtsEvent( 304 controller->OnTtsEvent(
306 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); 305 utterance_id, TTS_EVENT_RESUME, char_index, std::string());
307 } else { 306 } else {
308 EXTENSION_FUNCTION_VALIDATE(false); 307 EXTENSION_FUNCTION_VALIDATE(false);
309 } 308 }
310 309
311 return true; 310 return true;
312 } 311 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.cc ('k') | chrome/browser/task_manager/extension_information.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698