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

Side by Side Diff: chrome/browser/extensions/activity_log/uma_policy.cc

Issue 368133005: Fixes for re-enabling more MSVC level 4 warnings: chrome/browser/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/activity_log/uma_policy.h" 5 #include "chrome/browser/extensions/activity_log/uma_policy.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/active_script_controller.h" 10 #include "chrome/browser/extensions/active_script_controller.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return; 98 return;
99 99
100 SiteMap::iterator site_lookup = url_status_.find(url); 100 SiteMap::iterator site_lookup = url_status_.find(url);
101 if (site_lookup != url_status_.end()) 101 if (site_lookup != url_status_.end())
102 site_lookup->second[action->extension_id()] |= status; 102 site_lookup->second[action->extension_id()] |= status;
103 } 103 }
104 104
105 int UmaPolicy::MatchActionToStatus(scoped_refptr<Action> action) { 105 int UmaPolicy::MatchActionToStatus(scoped_refptr<Action> action) {
106 if (action->action_type() == Action::ACTION_CONTENT_SCRIPT) { 106 if (action->action_type() == Action::ACTION_CONTENT_SCRIPT) {
107 return kContentScript; 107 return kContentScript;
108 } else if (action->action_type() == Action::ACTION_API_CALL && 108 }
109 action->api_name() == "tabs.executeScript") { 109 if (action->action_type() == Action::ACTION_API_CALL &&
110 action->api_name() == "tabs.executeScript") {
110 return kContentScript; 111 return kContentScript;
111 } else if (action->action_type() != Action::ACTION_DOM_ACCESS) { 112 }
Finnur 2014/07/03 12:17:54 nit: None of these return line need the braces (li
Peter Kasting 2014/07/07 19:15:29 Sure, I can remove these.
113 if (action->action_type() != Action::ACTION_DOM_ACCESS)
112 return kNoStatus; 114 return kNoStatus;
113 }
114 115
115 int dom_verb; 116 int dom_verb = DomActionType::MODIFIED;
116 if (!action->other() || 117 if (!action->other() ||
117 !action->other()->GetIntegerWithoutPathExpansion( 118 !action->other()->GetIntegerWithoutPathExpansion(
118 activity_log_constants::kActionDomVerb, &dom_verb)) { 119 activity_log_constants::kActionDomVerb, &dom_verb)) {
119 return kNoStatus; 120 return kNoStatus;
120 } 121 }
121 122
122 int ret_bit = kNoStatus; 123 int ret_bit = kNoStatus;
123 DomActionType::Type dom_type = static_cast<DomActionType::Type>(dom_verb); 124 DomActionType::Type dom_type = static_cast<DomActionType::Type>(dom_verb);
124 if (dom_type == DomActionType::GETTER) 125 if (dom_type == DomActionType::GETTER)
125 return kReadDom; 126 return kReadDom;
126 if (dom_type == DomActionType::SETTER) { 127 if (dom_type == DomActionType::SETTER)
127 ret_bit |= kModifiedDom; 128 ret_bit |= kModifiedDom;
128 } else if (dom_type == DomActionType::METHOD) { 129 else if (dom_type == DomActionType::METHOD)
129 ret_bit |= kDomMethod; 130 ret_bit |= kDomMethod;
130 } else { 131 else
131 return kNoStatus; 132 return kNoStatus;
132 }
133 133
134 if (action->api_name() == "HTMLDocument.write" || 134 if (action->api_name() == "HTMLDocument.write" ||
135 action->api_name() == "HTMLDocument.writeln") { 135 action->api_name() == "HTMLDocument.writeln") {
136 ret_bit |= kDocumentWrite; 136 ret_bit |= kDocumentWrite;
137 } else if (action->api_name() == "Element.innerHTML") { 137 } else if (action->api_name() == "Element.innerHTML") {
138 ret_bit |= kInnerHtml; 138 ret_bit |= kInnerHtml;
139 } else if (action->api_name() == "Document.createElement") { 139 } else if (action->api_name() == "Document.createElement") {
140 std::string arg; 140 std::string arg;
141 action->args()->GetString(0, &arg); 141 action->args()->GetString(0, &arg);
142 if (arg == "script") { 142 if (arg == "script") {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 return "AdLikelyReplaced"; 454 return "AdLikelyReplaced";
455 case NONE: 455 case NONE:
456 case MAX_STATUS: 456 case MAX_STATUS:
457 default: 457 default:
458 NOTREACHED(); 458 NOTREACHED();
459 return ""; 459 return "";
460 } 460 }
461 } 461 }
462 462
463 } // namespace extensions 463 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698