OLD | NEW |
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/script_badge_controller.h" | 5 #include "chrome/browser/extensions/script_badge_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "chrome/browser/extensions/browser_event_router.h" | 10 #include "chrome/browser/extensions/browser_event_router.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 NotifyChange(); | 121 NotifyChange(); |
122 } else if (current_page_id < 0) { | 122 } else if (current_page_id < 0) { |
123 // Tracking down http://crbug.com/138323. | 123 // Tracking down http://crbug.com/138323. |
124 std::string message = base::StringPrintf( | 124 std::string message = base::StringPrintf( |
125 "Expected a page ID of %d but there was no navigation entry. " | 125 "Expected a page ID of %d but there was no navigation entry. " |
126 "Extension ID is %s.", | 126 "Extension ID is %s.", |
127 on_page_id, | 127 on_page_id, |
128 extension_id.c_str()); | 128 extension_id.c_str()); |
129 char buf[1024]; | 129 char buf[1024]; |
130 base::snprintf(buf, arraysize(buf), "%s", message.c_str()); | 130 base::snprintf(buf, arraysize(buf), "%s", message.c_str()); |
131 CHECK(false) << message; | 131 LOG(ERROR) << message; |
| 132 return; |
132 } | 133 } |
133 } | 134 } |
134 | 135 |
135 ExtensionService* ScriptBadgeController::GetExtensionService() { | 136 ExtensionService* ScriptBadgeController::GetExtensionService() { |
136 return extensions::ExtensionSystem::Get( | 137 return extensions::ExtensionSystem::Get( |
137 tab_contents_->profile())->extension_service(); | 138 tab_contents_->profile())->extension_service(); |
138 } | 139 } |
139 | 140 |
140 int32 ScriptBadgeController::GetPageID() { | 141 int32 ScriptBadgeController::GetPageID() { |
141 content::NavigationEntry* nav_entry = | 142 content::NavigationEntry* nav_entry = |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 198 |
198 if (current_page_id < 0) { | 199 if (current_page_id < 0) { |
199 // Tracking down http://crbug.com/138323. | 200 // Tracking down http://crbug.com/138323. |
200 std::string message = base::StringPrintf( | 201 std::string message = base::StringPrintf( |
201 "Expected a page ID of %d but there was no navigation entry. " | 202 "Expected a page ID of %d but there was no navigation entry. " |
202 "Extension IDs are %s.", | 203 "Extension IDs are %s.", |
203 on_page_id, | 204 on_page_id, |
204 JoinExtensionIDs(extension_ids).c_str()); | 205 JoinExtensionIDs(extension_ids).c_str()); |
205 char buf[1024]; | 206 char buf[1024]; |
206 base::snprintf(buf, arraysize(buf), "%s", message.c_str()); | 207 base::snprintf(buf, arraysize(buf), "%s", message.c_str()); |
207 CHECK(false) << message; | 208 LOG(ERROR) << message; |
| 209 return; |
208 } | 210 } |
209 | 211 |
210 bool changed = false; | 212 bool changed = false; |
211 for (std::set<std::string>::const_iterator it = extension_ids.begin(); | 213 for (std::set<std::string>::const_iterator it = extension_ids.begin(); |
212 it != extension_ids.end(); ++it) { | 214 it != extension_ids.end(); ++it) { |
213 changed |= MarkExtensionExecuting(*it); | 215 changed |= MarkExtensionExecuting(*it); |
214 } | 216 } |
215 if (changed) | 217 if (changed) |
216 NotifyChange(); | 218 NotifyChange(); |
217 } | 219 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 current_actions_.erase(it); | 265 current_actions_.erase(it); |
264 break; | 266 break; |
265 } | 267 } |
266 } | 268 } |
267 | 269 |
268 CHECK_EQ(size_before, current_actions_.size() + 1); | 270 CHECK_EQ(size_before, current_actions_.size() + 1); |
269 return true; | 271 return true; |
270 } | 272 } |
271 | 273 |
272 } // namespace extensions | 274 } // namespace extensions |
OLD | NEW |