blob: 3e4c00a2ca294570d388fb9aa0e1f8aa65a07510 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/native_browser_frame_factory.h"
#include "chrome/grit/chromium_strings.h"
#include "components/safe_browsing/password_protection/metrics_util.h"
#if defined(USE_AURA)
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#endif
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/widget/widget.h"
// static
BrowserWindow* BrowserWindow::CreateBrowserWindow(
std::unique_ptr<Browser> browser,
bool user_gesture) {
// Create the view and the frame. The frame will attach itself via the view
// so we don't need to do anything with the pointer.
BrowserView* view = new BrowserView(std::move(browser));
(new BrowserFrame(view))->InitBrowserFrame();
view->GetWidget()->non_client_view()->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
#if defined(USE_AURA)
// For now, all browser windows are true. This only works when USE_AURA
// because it requires gfx::NativeWindow to be an aura::Window*.
view->GetWidget()->GetNativeWindow()->SetProperty(
aura::client::kCreatedByUserGesture, user_gesture);
#endif
safe_browsing::LogContentsSize(view->GetContentsSize());
return view;
}