#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/extensions/window_controller_list.h"
#include "chrome/common/extensions/api/windows.h"
#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/notification_service.h"
+#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_system.h"
#if defined(TOOLKIT_GTK)
#include "ui/base/x/active_window_watcher_x.h"
#endif
+using content::BrowserContext;
+
namespace extensions {
namespace windows = extensions::api::windows;
#endif
}
-static void WillDispatchWindowFocusedEvent(Profile* new_active_profile,
+static void WillDispatchWindowFocusedEvent(BrowserContext* new_active_context,
int window_id,
- Profile* profile,
+ BrowserContext* context,
const Extension* extension,
base::ListValue* event_args) {
// When switching between windows in the default and incognito profiles,
// dispatch WINDOW_ID_NONE to extensions whose profile lost focus that
// can't see the new focused window across the incognito boundary.
// See crbug.com/46610.
- if (new_active_profile && new_active_profile != profile &&
- !extension_util::CanCrossIncognito(
- extension,
- extensions::ExtensionSystem::Get(profile)->extension_service())) {
+ if (new_active_context && new_active_context != context &&
+ !util::CanCrossIncognito(extension, context)) {
event_args->Clear();
event_args->Append(new base::FundamentalValue(
extension_misc::kUnknownWindowId));
scoped_ptr<Event> event(new Event(windows::OnFocusChanged::kEventName,
make_scoped_ptr(new base::ListValue())));
event->will_dispatch_callback =
- base::Bind(&WillDispatchWindowFocusedEvent, window_profile, window_id);
+ base::Bind(&WillDispatchWindowFocusedEvent,
+ static_cast<BrowserContext*>(window_profile),
+ window_id);
ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent(event.Pass());
}
Profile* profile,
scoped_ptr<base::ListValue> args) {
scoped_ptr<Event> event(new Event(event_name, args.Pass()));
- event->restrict_to_profile = profile;
+ event->restrict_to_browser_context = profile;
ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass());
}