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/ui/views/athena/athena_util.h"
6
7#include "athena/activity/public/activity.h"
8#include "athena/activity/public/activity_manager.h"
9#include "athena/wm/public/window_list_provider.h"
10#include "athena/wm/public/window_manager.h"
11
12content::WebContents* GetWebContentsForWindow(aura::Window* owner_window) {
13  if (!owner_window) {
14    athena::WindowListProvider* window_list =
15        athena::WindowManager::Get()->GetWindowListProvider();
16    DCHECK(window_list->GetWindowList().size());
17    owner_window = window_list->GetWindowList().back();
18  }
19  athena::Activity* activity =
20      athena::ActivityManager::Get()->GetActivityForWindow(owner_window);
21  return activity->GetWebContents();
22}
23