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

Side by Side Diff: chrome/browser/shell_integration_win.cc

Issue 2479773002: Add chrome namespace to chrome/common/shell_handler_win.mojom (Closed)
Patch Set: Add chrome namespace to chrome/common/shell_handler_win.mojom Created 4 years, 1 month 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 (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/shell_integration_win.h" 5 #include "chrome/browser/shell_integration_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlwapi.h> 8 #include <shlwapi.h>
9 #include <shobjidl.h> 9 #include <shobjidl.h>
10 #include <propkey.h> // Needs to come after shobjidl.h. 10 #include <propkey.h> // Needs to come after shobjidl.h.
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 OpenSystemSettingsHelper* OpenSystemSettingsHelper::instance_ = nullptr; 433 OpenSystemSettingsHelper* OpenSystemSettingsHelper::instance_ = nullptr;
434 434
435 void RecordPinnedToTaskbarProcessError(bool error) { 435 void RecordPinnedToTaskbarProcessError(bool error) {
436 UMA_HISTOGRAM_BOOLEAN("Windows.IsPinnedToTaskbar.ProcessError", error); 436 UMA_HISTOGRAM_BOOLEAN("Windows.IsPinnedToTaskbar.ProcessError", error);
437 } 437 }
438 438
439 // Record the UMA histogram when a response is received. The callback that binds 439 // Record the UMA histogram when a response is received. The callback that binds
440 // to this function holds a reference to the ShellHandlerClient to keep it alive 440 // to this function holds a reference to the ShellHandlerClient to keep it alive
441 // until invokation. 441 // until invokation.
442 void OnIsPinnedToTaskbarResult( 442 void OnIsPinnedToTaskbarResult(
443 content::UtilityProcessMojoClient<mojom::ShellHandler>* client, 443 content::UtilityProcessMojoClient<chrome::mojom::ShellHandler>* client,
444 bool succeeded, 444 bool succeeded,
445 bool is_pinned_to_taskbar) { 445 bool is_pinned_to_taskbar) {
446 // Clean up the utility process. 446 // Clean up the utility process.
447 delete client; 447 delete client;
448 448
449 RecordPinnedToTaskbarProcessError(false); 449 RecordPinnedToTaskbarProcessError(false);
450 450
451 enum Result { NOT_PINNED, PINNED, FAILURE, NUM_RESULTS }; 451 enum Result { NOT_PINNED, PINNED, FAILURE, NUM_RESULTS };
452 452
453 Result result = FAILURE; 453 Result result = FAILURE;
454 if (succeeded) 454 if (succeeded)
455 result = is_pinned_to_taskbar ? PINNED : NOT_PINNED; 455 result = is_pinned_to_taskbar ? PINNED : NOT_PINNED;
456 UMA_HISTOGRAM_ENUMERATION("Windows.IsPinnedToTaskbar", result, NUM_RESULTS); 456 UMA_HISTOGRAM_ENUMERATION("Windows.IsPinnedToTaskbar", result, NUM_RESULTS);
457 } 457 }
458 458
459 // Called when a connection error happen with the shell handler process. A call 459 // Called when a connection error happen with the shell handler process. A call
460 // to this function is mutially exclusive with a call to 460 // to this function is mutially exclusive with a call to
461 // OnIsPinnedToTaskbarResult(). 461 // OnIsPinnedToTaskbarResult().
462 void OnShellHandlerConnectionError( 462 void OnShellHandlerConnectionError(
463 content::UtilityProcessMojoClient<mojom::ShellHandler>* client) { 463 content::UtilityProcessMojoClient<chrome::mojom::ShellHandler>* client) {
464 // Clean up the utility process. 464 // Clean up the utility process.
465 delete client; 465 delete client;
466 466
467 RecordPinnedToTaskbarProcessError(true); 467 RecordPinnedToTaskbarProcessError(true);
468 } 468 }
469 469
470 } // namespace 470 } // namespace
471 471
472 bool SetAsDefaultBrowser() { 472 bool SetAsDefaultBrowser() {
473 base::FilePath chrome_exe; 473 base::FilePath chrome_exe;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 base::Bind(&MigrateTaskbarPinsCallback), 708 base::Bind(&MigrateTaskbarPinsCallback),
709 base::TimeDelta::FromSeconds(kMigrateTaskbarPinsDelaySeconds)); 709 base::TimeDelta::FromSeconds(kMigrateTaskbarPinsDelaySeconds));
710 } 710 }
711 711
712 void RecordIsPinnedToTaskbarHistogram() { 712 void RecordIsPinnedToTaskbarHistogram() {
713 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 713 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
714 714
715 // The code to check if Chrome is pinned to the taskbar brings in shell 715 // The code to check if Chrome is pinned to the taskbar brings in shell
716 // extensions which can hinder stability so it is executed in a utility 716 // extensions which can hinder stability so it is executed in a utility
717 // process. 717 // process.
718 content::UtilityProcessMojoClient<mojom::ShellHandler>* client = 718 content::UtilityProcessMojoClient<chrome::mojom::ShellHandler>* client =
719 new content::UtilityProcessMojoClient<mojom::ShellHandler>( 719 new content::UtilityProcessMojoClient<chrome::mojom::ShellHandler>(
720 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_SHELL_HANDLER_NAME)); 720 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_SHELL_HANDLER_NAME));
721 721
722 client->set_error_callback( 722 client->set_error_callback(
723 base::Bind(&OnShellHandlerConnectionError, client)); 723 base::Bind(&OnShellHandlerConnectionError, client));
724 client->set_disable_sandbox(); 724 client->set_disable_sandbox();
725 client->Start(); 725 client->Start();
726 726
727 client->service()->IsPinnedToTaskbar( 727 client->service()->IsPinnedToTaskbar(
728 base::Bind(&OnIsPinnedToTaskbarResult, client)); 728 base::Bind(&OnIsPinnedToTaskbarResult, client));
729 } 729 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 if (base::PathExists(shortcut)) 860 if (base::PathExists(shortcut))
861 return shortcut; 861 return shortcut;
862 } 862 }
863 863
864 return base::FilePath(); 864 return base::FilePath();
865 } 865 }
866 866
867 } // namespace win 867 } // namespace win
868 868
869 } // namespace shell_integration 869 } // namespace shell_integration
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_utility_manifest_overlay.json ('k') | chrome/browser/ui/webui/welcome_win10_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698