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

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: Created 7 years, 10 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') | ui/base/clipboard/clipboard.h » ('J')
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)
sky 2013/02/20 18:26:02 use {} around these.
vasilii 2013/02/21 10:36:01 Done.
119 // We want to leave invalid SourceTag in the clipboard in order to
120 // collect statistic later.
sky 2013/02/20 18:26:02 statistic -> statistics
vasilii 2013/02/21 10:36:01 Done.
121 clipboard->WriteObjects(buffer,
122 ui::Clipboard::ObjectMap(),
123 ui::Clipboard::kInvalidSourceTag);
124 else
125 clipboard->Clear(buffer);
126 }
119 } 127 }
120 }; 128 };
121 129
122 // Returns existing OffTheRecordClipboardDestroyer or creates one. 130 // Returns existing OffTheRecordClipboardDestroyer or creates one.
123 OffTheRecordClipboardDestroyer* GetClipboardDestroyerForBrowserContext( 131 OffTheRecordClipboardDestroyer* GetClipboardDestroyerForBrowserContext(
124 BrowserContext* context) { 132 BrowserContext* context) {
125 if (base::SupportsUserData::Data* data = context->GetUserData( 133 if (base::SupportsUserData::Data* data = context->GetUserData(
126 kClipboardDestroyerKey)) 134 kClipboardDestroyerKey))
127 return static_cast<OffTheRecordClipboardDestroyer*>(data); 135 return static_cast<OffTheRecordClipboardDestroyer*>(data);
128 OffTheRecordClipboardDestroyer* data = new OffTheRecordClipboardDestroyer; 136 OffTheRecordClipboardDestroyer* data = new OffTheRecordClipboardDestroyer;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 #endif // !OS_IOS 333 #endif // !OS_IOS
326 334
327 BrowserContext::~BrowserContext() { 335 BrowserContext::~BrowserContext() {
328 #if !defined(OS_IOS) 336 #if !defined(OS_IOS)
329 if (GetUserData(kDownloadManagerKeyName)) 337 if (GetUserData(kDownloadManagerKeyName))
330 GetDownloadManager(this)->Shutdown(); 338 GetDownloadManager(this)->Shutdown();
331 #endif 339 #endif
332 } 340 }
333 341
334 } // namespace content 342 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard.h » ('j') | ui/base/clipboard/clipboard.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698