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

Side by Side Diff: chrome/browser/extensions/api/tabs/windows_event_router.cc

Issue 22885002: c/b/extensions, json_schema_compiler: Do not use Value::Create*. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed C-style casts. Created 7 years, 4 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/extensions/api/tabs/windows_event_router.h" 5 #include "chrome/browser/extensions/api/tabs/windows_event_router.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/event_names.h" 9 #include "chrome/browser/extensions/event_names.h"
10 #include "chrome/browser/extensions/event_router.h" 10 #include "chrome/browser/extensions/event_router.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 args.Pass()); 65 args.Pass());
66 } 66 }
67 67
68 void WindowsEventRouter::OnWindowControllerRemoved( 68 void WindowsEventRouter::OnWindowControllerRemoved(
69 WindowController* window_controller) { 69 WindowController* window_controller) {
70 if (!profile_->IsSameProfile(window_controller->profile())) 70 if (!profile_->IsSameProfile(window_controller->profile()))
71 return; 71 return;
72 72
73 int window_id = window_controller->GetWindowId(); 73 int window_id = window_controller->GetWindowId();
74 scoped_ptr<base::ListValue> args(new base::ListValue()); 74 scoped_ptr<base::ListValue> args(new base::ListValue());
75 args->Append(Value::CreateIntegerValue(window_id)); 75 args->Append(new base::FundamentalValue(window_id));
76 DispatchEvent(event_names::kOnWindowRemoved, window_controller->profile(), 76 DispatchEvent(event_names::kOnWindowRemoved, window_controller->profile(),
77 args.Pass()); 77 args.Pass());
78 } 78 }
79 79
80 #if defined(TOOLKIT_VIEWS) 80 #if defined(TOOLKIT_VIEWS)
81 void WindowsEventRouter::OnNativeFocusChange( 81 void WindowsEventRouter::OnNativeFocusChange(
82 gfx::NativeView focused_before, 82 gfx::NativeView focused_before,
83 gfx::NativeView focused_now) { 83 gfx::NativeView focused_now) {
84 if (!focused_now) 84 if (!focused_now)
85 OnActiveWindowChanged(NULL); 85 OnActiveWindowChanged(NULL);
(...skipping 24 matching lines...) Expand all
110 const Extension* extension, 110 const Extension* extension,
111 base::ListValue* event_args) { 111 base::ListValue* event_args) {
112 // When switching between windows in the default and incognito profiles, 112 // When switching between windows in the default and incognito profiles,
113 // dispatch WINDOW_ID_NONE to extensions whose profile lost focus that 113 // dispatch WINDOW_ID_NONE to extensions whose profile lost focus that
114 // can't see the new focused window across the incognito boundary. 114 // can't see the new focused window across the incognito boundary.
115 // See crbug.com/46610. 115 // See crbug.com/46610.
116 if (new_active_profile && new_active_profile != profile && 116 if (new_active_profile && new_active_profile != profile &&
117 !extensions::ExtensionSystem::Get(profile)->extension_service()-> 117 !extensions::ExtensionSystem::Get(profile)->extension_service()->
118 CanCrossIncognito(extension)) { 118 CanCrossIncognito(extension)) {
119 event_args->Clear(); 119 event_args->Clear();
120 event_args->Append(Value::CreateIntegerValue( 120 event_args->Append(new base::FundamentalValue(
121 extension_misc::kUnknownWindowId)); 121 extension_misc::kUnknownWindowId));
122 } else { 122 } else {
123 event_args->Clear(); 123 event_args->Clear();
124 event_args->Append(Value::CreateIntegerValue(window_id)); 124 event_args->Append(new base::FundamentalValue(window_id));
125 } 125 }
126 } 126 }
127 127
128 void WindowsEventRouter::OnActiveWindowChanged( 128 void WindowsEventRouter::OnActiveWindowChanged(
129 WindowController* window_controller) { 129 WindowController* window_controller) {
130 Profile* window_profile = NULL; 130 Profile* window_profile = NULL;
131 int window_id = extension_misc::kUnknownWindowId; 131 int window_id = extension_misc::kUnknownWindowId;
132 if (window_controller && 132 if (window_controller &&
133 profile_->IsSameProfile(window_controller->profile())) { 133 profile_->IsSameProfile(window_controller->profile())) {
134 window_profile = window_controller->profile(); 134 window_profile = window_controller->profile();
(...skipping 17 matching lines...) Expand all
152 152
153 void WindowsEventRouter::DispatchEvent(const char* event_name, 153 void WindowsEventRouter::DispatchEvent(const char* event_name,
154 Profile* profile, 154 Profile* profile,
155 scoped_ptr<base::ListValue> args) { 155 scoped_ptr<base::ListValue> args) {
156 scoped_ptr<Event> event(new Event(event_name, args.Pass())); 156 scoped_ptr<Event> event(new Event(event_name, args.Pass()));
157 event->restrict_to_profile = profile; 157 event->restrict_to_profile = profile;
158 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass()); 158 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass());
159 } 159 }
160 160
161 } // namespace extensions 161 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/extensions/api/test/test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698