OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/extensions/api/web_request/chrome_extension_web_request
_event_router_delegate.h" | 5 #include "chrome/browser/extensions/api/web_request/chrome_extension_web_request
_event_router_delegate.h" |
6 | 6 |
7 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" | 7 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" |
8 #include "chrome/browser/extensions/activity_log/activity_log.h" | 8 #include "chrome/browser/extensions/activity_log/activity_log.h" |
9 #include "chrome/browser/extensions/extension_action_runner.h" | 9 #include "chrome/browser/extensions/extension_action_runner.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 ChromeExtensionWebRequestEventRouterDelegate:: | 54 ChromeExtensionWebRequestEventRouterDelegate:: |
55 ~ChromeExtensionWebRequestEventRouterDelegate() { | 55 ~ChromeExtensionWebRequestEventRouterDelegate() { |
56 } | 56 } |
57 | 57 |
58 void ChromeExtensionWebRequestEventRouterDelegate::LogExtensionActivity( | 58 void ChromeExtensionWebRequestEventRouterDelegate::LogExtensionActivity( |
59 content::BrowserContext* browser_context, | 59 content::BrowserContext* browser_context, |
60 bool is_incognito, | 60 bool is_incognito, |
61 const std::string& extension_id, | 61 const std::string& extension_id, |
62 const GURL& url, | 62 const GURL& url, |
63 const std::string& api_call, | 63 const std::string& api_call, |
64 scoped_ptr<base::DictionaryValue> details) { | 64 std::unique_ptr<base::DictionaryValue> details) { |
65 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 65 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
66 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext( | 66 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext( |
67 browser_context)) { | 67 browser_context)) { |
68 return; | 68 return; |
69 } | 69 } |
70 | 70 |
71 scoped_refptr<extensions::Action> action = | 71 scoped_refptr<extensions::Action> action = |
72 new extensions::Action(extension_id, | 72 new extensions::Action(extension_id, |
73 base::Time::Now(), | 73 base::Time::Now(), |
74 extensions::Action::ACTION_WEB_REQUEST, | 74 extensions::Action::ACTION_WEB_REQUEST, |
75 api_call); | 75 api_call); |
76 action->set_page_url(url); | 76 action->set_page_url(url); |
77 action->set_page_incognito(is_incognito); | 77 action->set_page_incognito(is_incognito); |
78 action->mutable_other()->Set(activity_log_constants::kActionWebRequest, | 78 action->mutable_other()->Set(activity_log_constants::kActionWebRequest, |
79 details.release()); | 79 details.release()); |
80 extensions::ActivityLog::GetInstance(browser_context)->LogAction(action); | 80 extensions::ActivityLog::GetInstance(browser_context)->LogAction(action); |
81 } | 81 } |
82 | 82 |
83 void ChromeExtensionWebRequestEventRouterDelegate::NotifyWebRequestWithheld( | 83 void ChromeExtensionWebRequestEventRouterDelegate::NotifyWebRequestWithheld( |
84 int render_process_id, | 84 int render_process_id, |
85 int render_frame_id, | 85 int render_frame_id, |
86 const std::string& extension_id) { | 86 const std::string& extension_id) { |
87 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 87 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
88 content::BrowserThread::PostTask( | 88 content::BrowserThread::PostTask( |
89 content::BrowserThread::UI, FROM_HERE, | 89 content::BrowserThread::UI, FROM_HERE, |
90 base::Bind(&NotifyWebRequestWithheldOnUI, render_process_id, | 90 base::Bind(&NotifyWebRequestWithheldOnUI, render_process_id, |
91 render_frame_id, extension_id)); | 91 render_frame_id, extension_id)); |
92 } | 92 } |
OLD | NEW |