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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_guest.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 5 years 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/guest_view/web_view/web_view_guest.h" 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include <stddef.h>
8
7 #include <utility> 9 #include <utility>
8 10
9 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
10 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "build/build_config.h"
12 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" 15 #include "components/browsing_data/storage_partition_http_cache_data_remover.h"
13 #include "components/guest_view/browser/guest_view_event.h" 16 #include "components/guest_view/browser/guest_view_event.h"
14 #include "components/guest_view/browser/guest_view_manager.h" 17 #include "components/guest_view/browser/guest_view_manager.h"
15 #include "components/guest_view/common/guest_view_constants.h" 18 #include "components/guest_view/common/guest_view_constants.h"
16 #include "components/web_cache/browser/web_cache_manager.h" 19 #include "components/web_cache/browser/web_cache_manager.h"
17 #include "content/public/browser/browser_context.h" 20 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/child_process_security_policy.h" 22 #include "content/public/browser/child_process_security_policy.h"
20 #include "content/public/browser/native_web_keyboard_event.h" 23 #include "content/public/browser/native_web_keyboard_event.h"
21 #include "content/public/browser/navigation_entry.h" 24 #include "content/public/browser/navigation_entry.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 using guest_view::GuestViewEvent; 73 using guest_view::GuestViewEvent;
71 using guest_view::GuestViewManager; 74 using guest_view::GuestViewManager;
72 using ui_zoom::ZoomController; 75 using ui_zoom::ZoomController;
73 76
74 namespace extensions { 77 namespace extensions {
75 78
76 namespace { 79 namespace {
77 80
78 // Returns storage partition removal mask from web_view clearData mask. Note 81 // Returns storage partition removal mask from web_view clearData mask. Note
79 // that storage partition mask is a subset of webview's data removal mask. 82 // that storage partition mask is a subset of webview's data removal mask.
80 uint32 GetStoragePartitionRemovalMask(uint32 web_view_removal_mask) { 83 uint32_t GetStoragePartitionRemovalMask(uint32_t web_view_removal_mask) {
81 uint32 mask = 0; 84 uint32_t mask = 0;
82 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_APPCACHE) 85 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_APPCACHE)
83 mask |= StoragePartition::REMOVE_DATA_MASK_APPCACHE; 86 mask |= StoragePartition::REMOVE_DATA_MASK_APPCACHE;
84 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_COOKIES) 87 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_COOKIES)
85 mask |= StoragePartition::REMOVE_DATA_MASK_COOKIES; 88 mask |= StoragePartition::REMOVE_DATA_MASK_COOKIES;
86 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_FILE_SYSTEMS) 89 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_FILE_SYSTEMS)
87 mask |= StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS; 90 mask |= StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS;
88 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_INDEXEDDB) 91 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_INDEXEDDB)
89 mask |= StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; 92 mask |= StoragePartition::REMOVE_DATA_MASK_INDEXEDDB;
90 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_LOCAL_STORAGE) 93 if (web_view_removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_LOCAL_STORAGE)
91 mask |= StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; 94 mask |= StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 400
398 // We must install the mapping from guests to WebViews prior to resuming 401 // We must install the mapping from guests to WebViews prior to resuming
399 // suspended resource loads so that the WebRequest API will catch resource 402 // suspended resource loads so that the WebRequest API will catch resource
400 // requests. 403 // requests.
401 PushWebViewStateToIOThread(); 404 PushWebViewStateToIOThread();
402 405
403 ApplyAttributes(create_params); 406 ApplyAttributes(create_params);
404 } 407 }
405 408
406 void WebViewGuest::ClearDataInternal(base::Time remove_since, 409 void WebViewGuest::ClearDataInternal(base::Time remove_since,
407 uint32 removal_mask, 410 uint32_t removal_mask,
408 const base::Closure& callback) { 411 const base::Closure& callback) {
409 uint32 storage_partition_removal_mask = 412 uint32_t storage_partition_removal_mask =
410 GetStoragePartitionRemovalMask(removal_mask); 413 GetStoragePartitionRemovalMask(removal_mask);
411 if (!storage_partition_removal_mask) { 414 if (!storage_partition_removal_mask) {
412 callback.Run(); 415 callback.Run();
413 return; 416 return;
414 } 417 }
415 content::StoragePartition* partition = 418 content::StoragePartition* partition =
416 content::BrowserContext::GetStoragePartition( 419 content::BrowserContext::GetStoragePartition(
417 web_contents()->GetBrowserContext(), 420 web_contents()->GetBrowserContext(),
418 web_contents()->GetSiteInstance()); 421 web_contents()->GetSiteInstance());
419 partition->ClearData( 422 partition->ClearData(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 DispatchEventToView( 502 DispatchEventToView(
500 new GuestViewEvent(webview::kEventZoomChange, std::move(args))); 503 new GuestViewEvent(webview::kEventZoomChange, std::move(args)));
501 } 504 }
502 505
503 void WebViewGuest::WillDestroy() { 506 void WebViewGuest::WillDestroy() {
504 if (!attached() && GetOpener()) 507 if (!attached() && GetOpener())
505 GetOpener()->pending_new_windows_.erase(this); 508 GetOpener()->pending_new_windows_.erase(this);
506 } 509 }
507 510
508 bool WebViewGuest::AddMessageToConsole(WebContents* source, 511 bool WebViewGuest::AddMessageToConsole(WebContents* source,
509 int32 level, 512 int32_t level,
510 const base::string16& message, 513 const base::string16& message,
511 int32 line_no, 514 int32_t line_no,
512 const base::string16& source_id) { 515 const base::string16& source_id) {
513 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 516 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
514 // Log levels are from base/logging.h: LogSeverity. 517 // Log levels are from base/logging.h: LogSeverity.
515 args->SetInteger(webview::kLevel, level); 518 args->SetInteger(webview::kLevel, level);
516 args->SetString(webview::kMessage, message); 519 args->SetString(webview::kMessage, message);
517 args->SetInteger(webview::kLine, line_no); 520 args->SetInteger(webview::kLine, line_no);
518 args->SetString(webview::kSourceId, source_id); 521 args->SetString(webview::kSourceId, source_id);
519 DispatchEventToView( 522 DispatchEventToView(
520 new GuestViewEvent(webview::kEventConsoleMessage, std::move(args))); 523 new GuestViewEvent(webview::kEventConsoleMessage, std::move(args)));
521 return true; 524 return true;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 void WebViewGuest::Terminate() { 725 void WebViewGuest::Terminate() {
723 content::RecordAction(UserMetricsAction("WebView.Guest.Terminate")); 726 content::RecordAction(UserMetricsAction("WebView.Guest.Terminate"));
724 base::ProcessHandle process_handle = 727 base::ProcessHandle process_handle =
725 web_contents()->GetRenderProcessHost()->GetHandle(); 728 web_contents()->GetRenderProcessHost()->GetHandle();
726 if (process_handle) 729 if (process_handle)
727 web_contents()->GetRenderProcessHost()->Shutdown( 730 web_contents()->GetRenderProcessHost()->Shutdown(
728 content::RESULT_CODE_KILLED, false); 731 content::RESULT_CODE_KILLED, false);
729 } 732 }
730 733
731 bool WebViewGuest::ClearData(base::Time remove_since, 734 bool WebViewGuest::ClearData(base::Time remove_since,
732 uint32 removal_mask, 735 uint32_t removal_mask,
733 const base::Closure& callback) { 736 const base::Closure& callback) {
734 content::RecordAction(UserMetricsAction("WebView.Guest.ClearData")); 737 content::RecordAction(UserMetricsAction("WebView.Guest.ClearData"));
735 content::StoragePartition* partition = 738 content::StoragePartition* partition =
736 content::BrowserContext::GetStoragePartition( 739 content::BrowserContext::GetStoragePartition(
737 web_contents()->GetBrowserContext(), 740 web_contents()->GetBrowserContext(),
738 web_contents()->GetSiteInstance()); 741 web_contents()->GetSiteInstance());
739 742
740 if (!partition) 743 if (!partition)
741 return false; 744 return false;
742 745
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 1502 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1500 DispatchEventToView( 1503 DispatchEventToView(
1501 new GuestViewEvent(webview::kEventExitFullscreen, std::move(args))); 1504 new GuestViewEvent(webview::kEventExitFullscreen, std::move(args)));
1502 } 1505 }
1503 // Since we changed fullscreen state, sending a Resize message ensures that 1506 // Since we changed fullscreen state, sending a Resize message ensures that
1504 // renderer/ sees the change. 1507 // renderer/ sees the change.
1505 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); 1508 web_contents()->GetRenderViewHost()->GetWidget()->WasResized();
1506 } 1509 }
1507 1510
1508 } // namespace extensions 1511 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698