| Index: chrome/browser/views/frame/embedded_frame.cc
|
| ===================================================================
|
| --- chrome/browser/views/frame/embedded_frame.cc (revision 0)
|
| +++ chrome/browser/views/frame/embedded_frame.cc (revision 0)
|
| @@ -0,0 +1,121 @@
|
| +// Copyright (c) 2006-2008 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 "chrome/browser/views/frame/embedded_frame.h"
|
| +
|
| +#include "chrome/browser/frame_util.h"
|
| +#include "chrome/browser/views/frame/browser_view.h"
|
| +#include "chrome/browser/views/frame/embedded_non_client_view.h"
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////
|
| +// EmbeddedFrame, public:
|
| +
|
| +EmbeddedFrame::EmbeddedFrame(BrowserView* browser_view)
|
| + : CustomFrameWindow(browser_view, new EmbeddedNonClientView(this,
|
| + browser_view)),
|
| + browser_view_(browser_view) {
|
| + browser_view_->set_frame(this);
|
| + set_window_style(WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
| +}
|
| +
|
| +EmbeddedFrame::~EmbeddedFrame() {
|
| +}
|
| +
|
| +void EmbeddedFrame::Init(HWND parent, const gfx::Rect& bounds) {
|
| + CustomFrameWindow::Init(parent, bounds);
|
| +}
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////
|
| +// EmbeddedFrame, BrowserFrame implementation:
|
| +
|
| +gfx::Rect EmbeddedFrame::GetWindowBoundsForClientBounds(
|
| + const gfx::Rect& client_bounds) {
|
| + return client_bounds;
|
| +}
|
| +
|
| +void EmbeddedFrame::SizeToContents(const gfx::Rect& contents_bounds) {
|
| + SetBounds(contents_bounds);
|
| +}
|
| +
|
| +gfx::Rect EmbeddedFrame::GetBoundsForTabStrip(TabStrip* tabstrip) const {
|
| + return gfx::Rect(0,0,0,0);
|
| +}
|
| +
|
| +void EmbeddedFrame::UpdateThrobber(bool running) {
|
| +}
|
| +
|
| +views::Window* EmbeddedFrame::GetWindow() {
|
| + return this;
|
| +}
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////
|
| +// EmbeddedFrame, views::CustomFrameWindow overrides:
|
| +
|
| +void EmbeddedFrame::UpdateWindowIcon() {
|
| + CustomFrameWindow::UpdateWindowIcon();
|
| +}
|
| +
|
| +int EmbeddedFrame::GetShowState() const {
|
| + return browser_view_->GetShowState();
|
| +}
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////
|
| +// EmbeddedFrame, views::ContainerWin overrides:
|
| +
|
| +bool EmbeddedFrame::AcceleratorPressed(views::Accelerator* accelerator) {
|
| + return browser_view_->AcceleratorPressed(*accelerator);
|
| +}
|
| +
|
| +bool EmbeddedFrame::GetAccelerator(int cmd_id, views::Accelerator* accelerator) {
|
| + return browser_view_->GetAccelerator(cmd_id, accelerator);
|
| +}
|
| +
|
| +void EmbeddedFrame::OnEndSession(BOOL ending, UINT logoff) {
|
| + FrameUtil::EndSession();
|
| +}
|
| +
|
| +void EmbeddedFrame::OnInitMenuPopup(HMENU menu, UINT position,
|
| + BOOL is_system_menu) {
|
| + browser_view_->PrepareToRunSystemMenu(menu);
|
| +}
|
| +
|
| +LRESULT EmbeddedFrame::OnMouseActivate(HWND window, UINT hittest_code,
|
| + UINT message) {
|
| + return browser_view_->ActivateAppModalDialog() ? MA_NOACTIVATEANDEAT
|
| + : MA_ACTIVATE;
|
| +}
|
| +
|
| +void EmbeddedFrame::OnMove(const CPoint& point) {
|
| + browser_view_->WindowMoved();
|
| +}
|
| +
|
| +void EmbeddedFrame::OnMoving(UINT param, const RECT* new_bounds) {
|
| + browser_view_->WindowMoved();
|
| +}
|
| +
|
| +LRESULT EmbeddedFrame::OnNCActivate(BOOL active) {
|
| + if (browser_view_->ActivateAppModalDialog())
|
| + return TRUE;
|
| +
|
| + CustomFrameWindow::OnNCActivate(active);
|
| + browser_view_->ActivationChanged(!!active);
|
| + return TRUE;
|
| +}
|
| +
|
| +void EmbeddedFrame::OnSysCommand(UINT notification_code, CPoint click) {
|
| + if (!browser_view_->SystemCommandReceived(notification_code,
|
| + gfx::Point(click))) {
|
| + // Use the default implementation for any other command.
|
| + CustomFrameWindow::OnSysCommand(notification_code, click);
|
| + }
|
| +}
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////
|
| +// EmbeddedFrame, private:
|
| +
|
| +EmbeddedNonClientView* EmbeddedFrame::GetEmbeddedNonClientView() const {
|
| + // We can safely assume that this conversion is true.
|
| + return static_cast<EmbeddedNonClientView*>(non_client_view_);
|
| +}
|
| +
|
|
|