| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_host/chrome_extension_message_filter.h" | 5 #include "chrome/browser/renderer_host/chrome_extension_message_filter.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" | 16 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" |
| 14 #include "chrome/browser/extensions/activity_log/activity_actions.h" | 17 #include "chrome/browser/extensions/activity_log/activity_actions.h" |
| 15 #include "chrome/browser/extensions/activity_log/activity_log.h" | 18 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 16 #include "chrome/browser/extensions/api/activity_log_private/activity_log_privat
e_api.h" | 19 #include "chrome/browser/extensions/api/activity_log_private/activity_log_privat
e_api.h" |
| 17 #include "chrome/browser/extensions/api/messaging/message_service.h" | 20 #include "chrome/browser/extensions/api/messaging/message_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/common/extensions/chrome_extension_messages.h" | 23 #include "chrome/common/extensions/chrome_extension_messages.h" |
| 21 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
| 23 #include "extensions/browser/extension_system.h" | 26 #include "extensions/browser/extension_system.h" |
| 24 #include "extensions/common/api/messaging/message.h" | 27 #include "extensions/common/api/messaging/message.h" |
| 25 #include "extensions/common/extension_messages.h" | 28 #include "extensions/common/extension_messages.h" |
| 26 #include "extensions/common/file_util.h" | 29 #include "extensions/common/file_util.h" |
| 27 #include "extensions/common/manifest_handlers/default_locale_handler.h" | 30 #include "extensions/common/manifest_handlers/default_locale_handler.h" |
| 28 #include "extensions/common/message_bundle.h" | 31 #include "extensions/common/message_bundle.h" |
| 29 | 32 |
| 30 using content::BrowserThread; | 33 using content::BrowserThread; |
| 31 | 34 |
| 32 namespace { | 35 namespace { |
| 33 | 36 |
| 34 const uint32 kFilteredMessageClasses[] = { | 37 const uint32_t kFilteredMessageClasses[] = { |
| 35 ChromeExtensionMsgStart, | 38 ChromeExtensionMsgStart, ExtensionMsgStart, |
| 36 ExtensionMsgStart, | |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 // Logs an action to the extension activity log for the specified profile. Can | 41 // Logs an action to the extension activity log for the specified profile. Can |
| 40 // be called from any thread. | 42 // be called from any thread. |
| 41 void AddActionToExtensionActivityLog( | 43 void AddActionToExtensionActivityLog( |
| 42 Profile* profile, | 44 Profile* profile, |
| 43 scoped_refptr<extensions::Action> action) { | 45 scoped_refptr<extensions::Action> action) { |
| 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 46 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 45 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) | 47 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) |
| 46 return; | 48 return; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 AddActionToExtensionActivityLog(profile_, action); | 318 AddActionToExtensionActivityLog(profile_, action); |
| 317 } | 319 } |
| 318 | 320 |
| 319 void ChromeExtensionMessageFilter::Observe( | 321 void ChromeExtensionMessageFilter::Observe( |
| 320 int type, | 322 int type, |
| 321 const content::NotificationSource& source, | 323 const content::NotificationSource& source, |
| 322 const content::NotificationDetails& details) { | 324 const content::NotificationDetails& details) { |
| 323 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 325 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
| 324 profile_ = NULL; | 326 profile_ = NULL; |
| 325 } | 327 } |
| OLD | NEW |