15f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// found in the LICENSE file.
4d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
51320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "extensions/browser/app_window/app_window_client.h"
6d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
7d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "base/basictypes.h"
8d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
91320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace extensions {
10d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
11d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)namespace {
12d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciAppWindowClient* g_client = NULL;
14d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
15d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)}  // namespace
16d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciAppWindowClient* AppWindowClient::Get() {
18d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  return g_client;
19d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)}
20d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccivoid AppWindowClient::Set(AppWindowClient* client) {
22d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // This can happen in unit tests, where the utility thread runs in-process.
23d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  if (g_client)
24d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    return;
25d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
26d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  g_client = client;
27d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)}
28d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}  // namespace extensions
30