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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api.cc

Issue 18430004: Sets correct ActivityLog enabled status to the first renderer process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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/web_request/web_request_api.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 profile_id, 1627 profile_id,
1628 is_incognito, 1628 is_incognito,
1629 extension_id, 1629 extension_id,
1630 url, 1630 url,
1631 api_call, 1631 api_call,
1632 base::Passed(&details))); 1632 base::Passed(&details)));
1633 } else { 1633 } else {
1634 Profile* profile = static_cast<Profile*>(profile_id); 1634 Profile* profile = static_cast<Profile*>(profile_id);
1635 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) 1635 if (!g_browser_process->profile_manager()->IsValidProfile(profile))
1636 return; 1636 return;
1637 extensions::ActivityLog::GetInstance(profile)->LogWebRequestAction( 1637 extensions::ActivityLog* activity_log =
1638 extensions::ActivityLog::GetInstance(profile);
1639 if (!activity_log->IsLogEnabled())
1640 return;
1641 activity_log->LogWebRequestAction(
1638 extension_id, 1642 extension_id,
1639 is_incognito ? GURL(extensions::APIAction::kIncognitoUrl) : url, 1643 is_incognito ? GURL(extensions::APIAction::kIncognitoUrl) : url,
1640 api_call, 1644 api_call,
1641 details.Pass(), 1645 details.Pass(),
1642 ""); 1646 "");
1643 } 1647 }
1644 } 1648 }
1645 1649
1646 } // namespace 1650 } // namespace
1647 1651
(...skipping 11 matching lines...) Expand all
1659 return; 1663 return;
1660 1664
1661 BlockedRequest& blocked_request = blocked_requests_[request_id]; 1665 BlockedRequest& blocked_request = blocked_requests_[request_id];
1662 int num_handlers_blocking = --blocked_request.num_handlers_blocking; 1666 int num_handlers_blocking = --blocked_request.num_handlers_blocking;
1663 CHECK_GE(num_handlers_blocking, 0); 1667 CHECK_GE(num_handlers_blocking, 0);
1664 1668
1665 if (response) { 1669 if (response) {
1666 helpers::EventResponseDelta* delta = 1670 helpers::EventResponseDelta* delta =
1667 CalculateDelta(&blocked_request, response); 1671 CalculateDelta(&blocked_request, response);
1668 1672
1669 if (extensions::ActivityLog::IsLogEnabledOnAnyProfile()) { 1673 LogExtensionActivity(profile,
1670 LogExtensionActivity(profile, 1674 blocked_request.is_incognito,
1671 blocked_request.is_incognito, 1675 extension_id,
1672 extension_id, 1676 blocked_request.request->url(),
1673 blocked_request.request->url(), 1677 event_name,
1674 event_name, 1678 SummarizeResponseDelta(event_name, *delta));
1675 SummarizeResponseDelta(event_name, *delta));
1676 }
1677 1679
1678 blocked_request.response_deltas.push_back( 1680 blocked_request.response_deltas.push_back(
1679 linked_ptr<helpers::EventResponseDelta>(delta)); 1681 linked_ptr<helpers::EventResponseDelta>(delta));
1680 } 1682 }
1681 1683
1682 base::TimeDelta block_time = 1684 base::TimeDelta block_time =
1683 base::Time::Now() - blocked_request.blocking_time; 1685 base::Time::Now() - blocked_request.blocking_time;
1684 if (!extension_id.empty()) { 1686 if (!extension_id.empty()) {
1685 request_time_tracker_->IncrementExtensionBlockTime( 1687 request_time_tracker_->IncrementExtensionBlockTime(
1686 extension_id, request_id, block_time); 1688 extension_id, request_id, block_time);
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2288 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 2290 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
2289 adblock = true; 2291 adblock = true;
2290 } else { 2292 } else {
2291 other = true; 2293 other = true;
2292 } 2294 }
2293 } 2295 }
2294 } 2296 }
2295 2297
2296 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 2298 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
2297 } 2299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698