OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. |
6 | 6 |
7 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 7 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 ExtensionWebNavigationEventRouter::ExtensionWebNavigationEventRouter( | 334 ExtensionWebNavigationEventRouter::ExtensionWebNavigationEventRouter( |
335 Profile* profile) : profile_(profile) {} | 335 Profile* profile) : profile_(profile) {} |
336 | 336 |
337 ExtensionWebNavigationEventRouter::~ExtensionWebNavigationEventRouter() {} | 337 ExtensionWebNavigationEventRouter::~ExtensionWebNavigationEventRouter() {} |
338 | 338 |
339 void ExtensionWebNavigationEventRouter::Init() { | 339 void ExtensionWebNavigationEventRouter::Init() { |
340 if (registrar_.IsEmpty()) { | 340 if (registrar_.IsEmpty()) { |
341 registrar_.Add(this, | 341 registrar_.Add(this, |
342 content::NOTIFICATION_RETARGETING, | 342 content::NOTIFICATION_RETARGETING, |
343 Source<Profile>(profile_)); | 343 Source<content::BrowserContext>(profile_)); |
344 registrar_.Add(this, | 344 registrar_.Add(this, |
345 content::NOTIFICATION_TAB_ADDED, | 345 content::NOTIFICATION_TAB_ADDED, |
346 NotificationService::AllSources()); | 346 NotificationService::AllSources()); |
347 registrar_.Add(this, | 347 registrar_.Add(this, |
348 content::NOTIFICATION_TAB_CONTENTS_DESTROYED, | 348 content::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
349 NotificationService::AllSources()); | 349 NotificationService::AllSources()); |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 void ExtensionWebNavigationEventRouter::Observe( | 353 void ExtensionWebNavigationEventRouter::Observe( |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 DictionaryValue* resultDict = new DictionaryValue(); | 624 DictionaryValue* resultDict = new DictionaryValue(); |
625 resultDict->SetString( | 625 resultDict->SetString( |
626 keys::kUrlKey, | 626 keys::kUrlKey, |
627 frame_navigation_state.GetUrl(frame_id).spec()); | 627 frame_navigation_state.GetUrl(frame_id).spec()); |
628 resultDict->SetBoolean( | 628 resultDict->SetBoolean( |
629 keys::kErrorOccurredKey, | 629 keys::kErrorOccurredKey, |
630 frame_navigation_state.GetErrorOccurredInFrame(frame_id)); | 630 frame_navigation_state.GetErrorOccurredInFrame(frame_id)); |
631 result_.reset(resultDict); | 631 result_.reset(resultDict); |
632 return true; | 632 return true; |
633 } | 633 } |
OLD | NEW |