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

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

Issue 1200503002: [Extensions] Kill off ExtensionMsg_AddMessageToConsole (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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"
11 #include "chrome/browser/extensions/component_loader.h" 11 #include "chrome/browser/extensions/component_loader.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/speech/extension_api/tts_engine_extension_observer.h" 14 #include "chrome/browser/speech/extension_api/tts_engine_extension_observer.h"
15 #include "chrome/browser/speech/extension_api/tts_extension_api.h" 15 #include "chrome/browser/speech/extension_api/tts_extension_api.h"
16 #include "chrome/browser/speech/extension_api/tts_extension_api_constants.h" 16 #include "chrome/browser/speech/extension_api/tts_extension_api_constants.h"
17 #include "chrome/browser/speech/tts_controller.h" 17 #include "chrome/browser/speech/tts_controller.h"
18 #include "chrome/common/extensions/api/speech/tts_engine_manifest_handler.h" 18 #include "chrome/common/extensions/api/speech/tts_engine_manifest_handler.h"
19 #include "chrome/common/extensions/extension_constants.h" 19 #include "chrome/common/extensions/extension_constants.h"
20 #include "content/public/browser/render_frame_host.h"
20 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/console_message_level.h" 23 #include "content/public/common/console_message_level.h"
23 #include "extensions/browser/event_router.h" 24 #include "extensions/browser/event_router.h"
24 #include "extensions/browser/extension_host.h" 25 #include "extensions/browser/extension_host.h"
25 #include "extensions/browser/extension_registry.h" 26 #include "extensions/browser/extension_registry.h"
26 #include "extensions/browser/extension_system.h" 27 #include "extensions/browser/extension_system.h"
27 #include "extensions/browser/process_manager.h" 28 #include "extensions/browser/process_manager.h"
28 #include "extensions/common/extension.h" 29 #include "extensions/common/extension.h"
29 #include "extensions/common/extension_messages.h"
30 #include "extensions/common/extension_set.h" 30 #include "extensions/common/extension_set.h"
31 #include "net/base/network_change_notifier.h" 31 #include "net/base/network_change_notifier.h"
32 32
33 using extensions::EventRouter; 33 using extensions::EventRouter;
34 using extensions::Extension; 34 using extensions::Extension;
35 using extensions::ExtensionSystem; 35 using extensions::ExtensionSystem;
36 36
37 namespace constants = tts_extension_api_constants; 37 namespace constants = tts_extension_api_constants;
38 38
39 namespace tts_engine_events { 39 namespace tts_engine_events {
(...skipping 10 matching lines...) Expand all
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::ExtensionHost* host = 57 extensions::ExtensionHost* host =
58 extensions::ProcessManager::Get(profile) 58 extensions::ProcessManager::Get(profile)
59 ->GetBackgroundHostForExtension(extension_id); 59 ->GetBackgroundHostForExtension(extension_id);
60 host->render_process_host()->Send(new ExtensionMsg_AddMessageToConsole( 60 host->host_contents()->GetMainFrame()->AddMessageToConsole(
61 host->render_view_host()->GetRoutingID(),
62 content::CONSOLE_MESSAGE_LEVEL_WARNING, 61 content::CONSOLE_MESSAGE_LEVEL_WARNING,
63 constants::kErrorMissingPauseOrResume)); 62 constants::kErrorMissingPauseOrResume);
not at google - send to devlin 2015/06/19 23:14:58 Same here.
Devlin 2015/06/22 19:52:32 This one doesn't even check that the background ho
64 } 63 }
65 64
66 } // namespace 65 } // namespace
67 66
68 TtsExtensionEngine* TtsExtensionEngine::GetInstance() { 67 TtsExtensionEngine* TtsExtensionEngine::GetInstance() {
69 return Singleton<TtsExtensionEngine>::get(); 68 return Singleton<TtsExtensionEngine>::get();
70 } 69 }
71 70
72 void TtsExtensionEngine::GetVoices(content::BrowserContext* browser_context, 71 void TtsExtensionEngine::GetVoices(content::BrowserContext* browser_context,
73 std::vector<VoiceData>* out_voices) { 72 std::vector<VoiceData>* out_voices) {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); 320 utterance_id, TTS_EVENT_PAUSE, char_index, std::string());
322 } else if (event_type == constants::kEventTypeResume) { 321 } else if (event_type == constants::kEventTypeResume) {
323 controller->OnTtsEvent( 322 controller->OnTtsEvent(
324 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); 323 utterance_id, TTS_EVENT_RESUME, char_index, std::string());
325 } else { 324 } else {
326 EXTENSION_FUNCTION_VALIDATE(false); 325 EXTENSION_FUNCTION_VALIDATE(false);
327 } 326 }
328 327
329 return true; 328 return true;
330 } 329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698