[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / top_level_widget_views.cc
bloba6254927c655b4c4e16d752b2091a0eb0ac44ddc
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/top_level_widget.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/views/frame/browser_view.h"
9 #include "ui/views/widget/widget.h"
11 namespace chrome {
13 views::Widget* GetTopLevelWidgetForBrowser(Browser* browser) {
14 if (!browser)
15 return NULL;
17 BrowserWindow* window = browser->window();
18 if (!window)
19 return NULL;
21 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
22 return browser_view ? browser_view->GetWidget() : NULL;
25 } // namespace chrome