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

Side by Side Diff: content/browser/browser_context.cc

Issue 12313009: Add UMA statistics to the clipboard (Closed) Base URL: http://git.chromium.org/chromium/src.git@bug-177140-fix-test
Patch Set: Remove unnecessary READ_* values Created 7 years, 9 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
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/public/browser/browser_context.h" 5 #include "content/public/browser/browser_context.h"
6 6
7 #if !defined(OS_IOS) 7 #if !defined(OS_IOS)
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "content/browser/appcache/chrome_appcache_service.h" 9 #include "content/browser/appcache/chrome_appcache_service.h"
10 #include "content/browser/dom_storage/dom_storage_context_impl.h" 10 #include "content/browser/dom_storage/dom_storage_context_impl.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 ui::Clipboard::SourceTag GetAsSourceTag() { 109 ui::Clipboard::SourceTag GetAsSourceTag() {
110 return ui::Clipboard::SourceTag(this); 110 return ui::Clipboard::SourceTag(this);
111 } 111 }
112 112
113 private: 113 private:
114 void ExamineClipboard(ui::Clipboard* clipboard, 114 void ExamineClipboard(ui::Clipboard* clipboard,
115 ui::Clipboard::Buffer buffer) { 115 ui::Clipboard::Buffer buffer) {
116 ui::Clipboard::SourceTag source_tag = clipboard->ReadSourceTag(buffer); 116 ui::Clipboard::SourceTag source_tag = clipboard->ReadSourceTag(buffer);
117 if (source_tag == ui::Clipboard::SourceTag(this)) 117 if (source_tag == ui::Clipboard::SourceTag(this)) {
118 clipboard->Clear(buffer); 118 if (buffer == ui::Clipboard::BUFFER_STANDARD) {
119 // We want to leave invalid SourceTag in the clipboard in order to
120 // collect statistics later.
121 clipboard->WriteObjects(buffer,
122 ui::Clipboard::ObjectMap(),
123 ui::Clipboard::kInvalidSourceTag);
124 } else {
125 clipboard->Clear(buffer);
126 }
127 }
119 } 128 }
120 }; 129 };
121 130
122 // Returns existing OffTheRecordClipboardDestroyer or creates one. 131 // Returns existing OffTheRecordClipboardDestroyer or creates one.
123 OffTheRecordClipboardDestroyer* GetClipboardDestroyerForBrowserContext( 132 OffTheRecordClipboardDestroyer* GetClipboardDestroyerForBrowserContext(
124 BrowserContext* context) { 133 BrowserContext* context) {
125 if (base::SupportsUserData::Data* data = context->GetUserData( 134 if (base::SupportsUserData::Data* data = context->GetUserData(
126 kClipboardDestroyerKey)) 135 kClipboardDestroyerKey))
127 return static_cast<OffTheRecordClipboardDestroyer*>(data); 136 return static_cast<OffTheRecordClipboardDestroyer*>(data);
128 OffTheRecordClipboardDestroyer* data = new OffTheRecordClipboardDestroyer; 137 OffTheRecordClipboardDestroyer* data = new OffTheRecordClipboardDestroyer;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 #endif // !OS_IOS 334 #endif // !OS_IOS
326 335
327 BrowserContext::~BrowserContext() { 336 BrowserContext::~BrowserContext() {
328 #if !defined(OS_IOS) 337 #if !defined(OS_IOS)
329 if (GetUserData(kDownloadManagerKeyName)) 338 if (GetUserData(kDownloadManagerKeyName))
330 GetDownloadManager(this)->Shutdown(); 339 GetDownloadManager(this)->Shutdown();
331 #endif 340 #endif
332 } 341 }
333 342
334 } // namespace content 343 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698