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
3// found in the LICENSE file.
4
5#include "chrome/browser/google/did_run_updater_win.h"
6
7#include "base/base_paths.h"
8#include "base/files/file_path.h"
9#include "base/path_service.h"
10#include "chrome/installer/util/google_update_settings.h"
11#include "chrome/installer/util/install_util.h"
12#include "content/public/browser/notification_details.h"
13#include "content/public/browser/notification_service.h"
14#include "content/public/browser/notification_source.h"
15#include "content/public/browser/notification_types.h"
16
17DidRunUpdater::DidRunUpdater() : system_level_(false) {
18  base::FilePath exe_path;
19  if (PathService::Get(base::FILE_EXE, &exe_path))
20    system_level_ = !InstallUtil::IsPerUserInstall(exe_path.value().c_str());
21
22  registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
23                 content::NotificationService::AllSources());
24}
25
26DidRunUpdater::~DidRunUpdater() {
27}
28
29void DidRunUpdater::Observe(int type,
30                            const content::NotificationSource& source,
31                            const content::NotificationDetails& details) {
32  GoogleUpdateSettings::UpdateDidRunState(true, system_level_);
33}
34