Remove EWK_BRINGUPS for M120 #3
[platform/framework/web/chromium-efl.git] / chrome / app / chrome_main_mac.mm
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/app/chrome_main_mac.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include <string>
10
11 #import "base/apple/bundle_locations.h"
12 #import "base/apple/foundation_util.h"
13 #include "base/command_line.h"
14 #include "base/files/file_path.h"
15 #include "base/path_service.h"
16 #include "base/strings/string_util.h"
17 #include "base/strings/sys_string_conversions.h"
18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_paths_internal.h"
20 #include "content/public/common/content_paths.h"
21 #include "content/public/common/content_switches.h"
22
23 void SetUpBundleOverrides() {
24   @autoreleasepool {
25     base::apple::SetOverrideFrameworkBundlePath(
26         chrome::GetFrameworkBundlePath());
27
28     NSBundle* base_bundle = chrome::OuterAppBundle();
29     base::apple::SetBaseBundleID(base_bundle.bundleIdentifier.UTF8String);
30
31     base::FilePath child_exe_path =
32         chrome::GetFrameworkBundlePath().Append("Helpers").Append(
33             chrome::kHelperProcessExecutablePath);
34
35     // On the Mac, the child executable lives at a predefined location within
36     // the app bundle's versioned directory.
37     base::PathService::OverrideAndCreateIfNeeded(
38         content::CHILD_PROCESS_EXE, child_exe_path, /*is_absolute=*/true,
39         /*create=*/false);
40   }
41 }
42
43 bool IsAlertsHelperLaunchedViaNotificationAction() {
44   // We allow the main Chrome app to be launched via a notification action. We
45   // detect and log that to UMA by checking the passed in NSNotification in
46   // -applicationDidFinishLaunching: (//chrome/browser/app_controller_mac.mm).
47   if (!base::apple::IsBackgroundOnlyProcess()) {
48     return false;
49   }
50
51   // If we have a process type then we were not launched by the system.
52   if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType))
53     return false;
54
55   base::FilePath path;
56   if (!base::PathService::Get(base::FILE_EXE, &path))
57     return false;
58
59   // Check if our executable name matches the helper app for notifications.
60   std::string helper_name = path.BaseName().value();
61   return base::EndsWith(helper_name, chrome::kMacHelperSuffixAlerts);
62 }