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

Side by Side Diff: ceee/ie/broker/window_events_funnel.cc

Issue 4989002: Firing event to broker without worker thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | « ceee/ie/broker/chrome_postman.cc ('k') | ceee/ie/broker/window_events_funnel_unittest.cc » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Funnel of Chrome Extension Events to be sent to Chrome. 5 // Funnel of Chrome Extension Events to be sent to Chrome.
6 6
7 #include "ceee/ie/broker/window_events_funnel.h" 7 #include "ceee/ie/broker/window_events_funnel.h"
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 std::string event_args_str; 106 std::string event_args_str;
107 if (event_args.IsType(Value::TYPE_LIST)) { 107 if (event_args.IsType(Value::TYPE_LIST)) {
108 base::JSONWriter::Write(&event_args, false, &event_args_str); 108 base::JSONWriter::Write(&event_args, false, &event_args_str);
109 } else { 109 } else {
110 ListValue list; 110 ListValue list;
111 list.Append(event_args.DeepCopy()); 111 list.Append(event_args.DeepCopy());
112 base::JSONWriter::Write(&list, false, &event_args_str); 112 base::JSONWriter::Write(&list, false, &event_args_str);
113 } 113 }
114 114
115 DCHECK(ChromePostman::GetInstance() != NULL); 115 DCHECK(ChromePostman::GetInstance() != NULL);
116 ChromePostman::GetInstance()->FireEvent(CComBSTR(event_name), 116 ChromePostman::GetInstance()->FireEvent(event_name, event_args_str.c_str());
117 CComBSTR(event_args_str.c_str()));
118 return S_OK; 117 return S_OK;
119 } 118 }
120 119
121 HRESULT WindowEventsFunnel::OnCreated(int window_id) { 120 HRESULT WindowEventsFunnel::OnCreated(int window_id) {
122 HWND window = reinterpret_cast<HWND>(window_id); 121 HWND window = reinterpret_cast<HWND>(window_id);
123 RECT window_rect; 122 RECT window_rect;
124 if (!::GetWindowRect(window, &window_rect)) { 123 if (!::GetWindowRect(window, &window_rect)) {
125 DWORD we = ::GetLastError(); 124 DWORD we = ::GetLastError();
126 DCHECK(false) << "GetWindowRect failed " << com::LogWe(we); 125 DCHECK(false) << "GetWindowRect failed " << com::LogWe(we);
127 return HRESULT_FROM_WIN32(we); 126 return HRESULT_FROM_WIN32(we);
(...skipping 17 matching lines...) Expand all
145 144
146 HRESULT WindowEventsFunnel::OnFocusChanged(int window_id) { 145 HRESULT WindowEventsFunnel::OnFocusChanged(int window_id) {
147 scoped_ptr<Value> args(Value::CreateIntegerValue(window_id)); 146 scoped_ptr<Value> args(Value::CreateIntegerValue(window_id));
148 return SendEvent(ext_event_names::kOnWindowFocusedChanged, *args.get()); 147 return SendEvent(ext_event_names::kOnWindowFocusedChanged, *args.get());
149 } 148 }
150 149
151 HRESULT WindowEventsFunnel::OnRemoved(int window_id) { 150 HRESULT WindowEventsFunnel::OnRemoved(int window_id) {
152 scoped_ptr<Value> args(Value::CreateIntegerValue(window_id)); 151 scoped_ptr<Value> args(Value::CreateIntegerValue(window_id));
153 return SendEvent(ext_event_names::kOnWindowRemoved, *args.get()); 152 return SendEvent(ext_event_names::kOnWindowRemoved, *args.get());
154 } 153 }
OLDNEW
« no previous file with comments | « ceee/ie/broker/chrome_postman.cc ('k') | ceee/ie/broker/window_events_funnel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698