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

Side by Side Diff: extensions/browser/api/device_permissions_manager.cc

Issue 1549643002: Switch to standard integer types in extensions/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean
Patch Set: Created 4 years, 12 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
OLDNEW
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 "extensions/browser/api/device_permissions_manager.h" 5 #include "extensions/browser/api/device_permissions_manager.h"
6 6
7 #include <stddef.h>
8
7 #include <utility> 9 #include <utility>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
11 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
14 #include "base/values.h" 16 #include "base/values.h"
15 #include "components/keyed_service/content/browser_context_dependency_manager.h" 17 #include "components/keyed_service/content/browser_context_dependency_manager.h"
16 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 entry->GetStringWithoutPathExpansion(kDeviceManufacturerString, 211 entry->GetStringWithoutPathExpansion(kDeviceManufacturerString,
210 &manufacturer_string); 212 &manufacturer_string);
211 213
212 base::string16 product_string; 214 base::string16 product_string;
213 // Ignore failure as this string is optional. 215 // Ignore failure as this string is optional.
214 entry->GetStringWithoutPathExpansion(kDeviceProductString, &product_string); 216 entry->GetStringWithoutPathExpansion(kDeviceProductString, &product_string);
215 217
216 // If a last used time is not stored in ExtensionPrefs last_used.is_null() 218 // If a last used time is not stored in ExtensionPrefs last_used.is_null()
217 // will be true. 219 // will be true.
218 std::string last_used_str; 220 std::string last_used_str;
219 int64 last_used_i64 = 0; 221 int64_t last_used_i64 = 0;
220 base::Time last_used; 222 base::Time last_used;
221 if (entry->GetStringWithoutPathExpansion(kDeviceLastUsed, &last_used_str) && 223 if (entry->GetStringWithoutPathExpansion(kDeviceLastUsed, &last_used_str) &&
222 base::StringToInt64(last_used_str, &last_used_i64)) { 224 base::StringToInt64(last_used_str, &last_used_i64)) {
223 last_used = base::Time::FromInternalValue(last_used_i64); 225 last_used = base::Time::FromInternalValue(last_used_i64);
224 } 226 }
225 227
226 std::string type; 228 std::string type;
227 if (!entry->GetStringWithoutPathExpansion(kDeviceType, &type)) { 229 if (!entry->GetStringWithoutPathExpansion(kDeviceType, &type)) {
228 return nullptr; 230 return nullptr;
229 } 231 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 402 }
401 403
402 // static 404 // static
403 DevicePermissionsManager* DevicePermissionsManager::Get( 405 DevicePermissionsManager* DevicePermissionsManager::Get(
404 BrowserContext* context) { 406 BrowserContext* context) {
405 return DevicePermissionsManagerFactory::GetForBrowserContext(context); 407 return DevicePermissionsManagerFactory::GetForBrowserContext(context);
406 } 408 }
407 409
408 // static 410 // static
409 base::string16 DevicePermissionsManager::GetPermissionMessage( 411 base::string16 DevicePermissionsManager::GetPermissionMessage(
410 uint16 vendor_id, 412 uint16_t vendor_id,
411 uint16 product_id, 413 uint16_t product_id,
412 const base::string16& manufacturer_string, 414 const base::string16& manufacturer_string,
413 const base::string16& product_string, 415 const base::string16& product_string,
414 const base::string16& serial_number, 416 const base::string16& serial_number,
415 bool always_include_manufacturer) { 417 bool always_include_manufacturer) {
416 base::string16 product = product_string; 418 base::string16 product = product_string;
417 if (product.empty()) { 419 if (product.empty()) {
418 const char* product_name = 420 const char* product_name =
419 device::UsbIds::GetProductName(vendor_id, product_id); 421 device::UsbIds::GetProductName(vendor_id, product_id);
420 if (product_name) { 422 if (product_name) {
421 product = base::UTF8ToUTF16(product_name); 423 product = base::UTF8ToUTF16(product_name);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 724
723 BrowserContext* DevicePermissionsManagerFactory::GetBrowserContextToUse( 725 BrowserContext* DevicePermissionsManagerFactory::GetBrowserContextToUse(
724 BrowserContext* context) const { 726 BrowserContext* context) const {
725 // Return the original (possibly off-the-record) browser context so that a 727 // Return the original (possibly off-the-record) browser context so that a
726 // separate instance of the DevicePermissionsManager is used in incognito 728 // separate instance of the DevicePermissionsManager is used in incognito
727 // mode. The parent class's implemenation returns NULL. 729 // mode. The parent class's implemenation returns NULL.
728 return context; 730 return context;
729 } 731 }
730 732
731 } // namespace extensions 733 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/device_permissions_manager.h ('k') | extensions/browser/api/device_permissions_prompt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698