| OLD | NEW | 
| (Empty) |  | 
 |    1 // Copyright (c) 2006-2008 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/views/frame/embedded_frame.h" | 
 |    6  | 
 |    7 #include "chrome/browser/frame_util.h" | 
 |    8 #include "chrome/browser/views/frame/browser_view.h" | 
 |    9 #include "chrome/browser/views/frame/embedded_non_client_view.h" | 
 |   10  | 
 |   11 /////////////////////////////////////////////////////////////////////////////// | 
 |   12 // EmbeddedFrame, public: | 
 |   13  | 
 |   14 EmbeddedFrame::EmbeddedFrame(BrowserView* browser_view) | 
 |   15     : CustomFrameWindow(browser_view, new EmbeddedNonClientView(this, | 
 |   16                                                               browser_view)), | 
 |   17       browser_view_(browser_view) { | 
 |   18   browser_view_->set_frame(this); | 
 |   19   set_window_style(WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); | 
 |   20 } | 
 |   21  | 
 |   22 EmbeddedFrame::~EmbeddedFrame() { | 
 |   23 } | 
 |   24  | 
 |   25 void EmbeddedFrame::Init(HWND parent, const gfx::Rect& bounds) { | 
 |   26   CustomFrameWindow::Init(parent, bounds); | 
 |   27 } | 
 |   28  | 
 |   29 /////////////////////////////////////////////////////////////////////////////// | 
 |   30 // EmbeddedFrame, BrowserFrame implementation: | 
 |   31  | 
 |   32 gfx::Rect EmbeddedFrame::GetWindowBoundsForClientBounds( | 
 |   33     const gfx::Rect& client_bounds) { | 
 |   34   return client_bounds; | 
 |   35 } | 
 |   36  | 
 |   37 void EmbeddedFrame::SizeToContents(const gfx::Rect& contents_bounds) { | 
 |   38   SetBounds(contents_bounds); | 
 |   39 } | 
 |   40  | 
 |   41 gfx::Rect EmbeddedFrame::GetBoundsForTabStrip(TabStrip* tabstrip) const { | 
 |   42   return gfx::Rect(0,0,0,0); | 
 |   43 } | 
 |   44  | 
 |   45 void EmbeddedFrame::UpdateThrobber(bool running) { | 
 |   46 } | 
 |   47  | 
 |   48 views::Window* EmbeddedFrame::GetWindow() { | 
 |   49   return this; | 
 |   50 } | 
 |   51  | 
 |   52 /////////////////////////////////////////////////////////////////////////////// | 
 |   53 // EmbeddedFrame, views::CustomFrameWindow overrides: | 
 |   54  | 
 |   55 void EmbeddedFrame::UpdateWindowIcon() { | 
 |   56   CustomFrameWindow::UpdateWindowIcon(); | 
 |   57 } | 
 |   58  | 
 |   59 int EmbeddedFrame::GetShowState() const { | 
 |   60   return browser_view_->GetShowState(); | 
 |   61 } | 
 |   62  | 
 |   63 /////////////////////////////////////////////////////////////////////////////// | 
 |   64 // EmbeddedFrame, views::ContainerWin overrides: | 
 |   65  | 
 |   66 bool EmbeddedFrame::AcceleratorPressed(views::Accelerator* accelerator) { | 
 |   67   return browser_view_->AcceleratorPressed(*accelerator); | 
 |   68 } | 
 |   69  | 
 |   70 bool EmbeddedFrame::GetAccelerator(int cmd_id, views::Accelerator* accelerator) 
     { | 
 |   71   return browser_view_->GetAccelerator(cmd_id, accelerator); | 
 |   72 } | 
 |   73  | 
 |   74 void EmbeddedFrame::OnEndSession(BOOL ending, UINT logoff) { | 
 |   75   FrameUtil::EndSession(); | 
 |   76 } | 
 |   77  | 
 |   78 void EmbeddedFrame::OnInitMenuPopup(HMENU menu, UINT position, | 
 |   79                                   BOOL is_system_menu) { | 
 |   80   browser_view_->PrepareToRunSystemMenu(menu); | 
 |   81 } | 
 |   82  | 
 |   83 LRESULT EmbeddedFrame::OnMouseActivate(HWND window, UINT hittest_code, | 
 |   84                                      UINT message) { | 
 |   85   return browser_view_->ActivateAppModalDialog() ? MA_NOACTIVATEANDEAT | 
 |   86                                                  : MA_ACTIVATE; | 
 |   87 } | 
 |   88  | 
 |   89 void EmbeddedFrame::OnMove(const CPoint& point) { | 
 |   90   browser_view_->WindowMoved(); | 
 |   91 } | 
 |   92  | 
 |   93 void EmbeddedFrame::OnMoving(UINT param, const RECT* new_bounds) { | 
 |   94   browser_view_->WindowMoved(); | 
 |   95 } | 
 |   96  | 
 |   97 LRESULT EmbeddedFrame::OnNCActivate(BOOL active) { | 
 |   98   if (browser_view_->ActivateAppModalDialog()) | 
 |   99     return TRUE; | 
 |  100  | 
 |  101   CustomFrameWindow::OnNCActivate(active); | 
 |  102   browser_view_->ActivationChanged(!!active); | 
 |  103   return TRUE; | 
 |  104 } | 
 |  105  | 
 |  106 void EmbeddedFrame::OnSysCommand(UINT notification_code, CPoint click) { | 
 |  107   if (!browser_view_->SystemCommandReceived(notification_code, | 
 |  108                                             gfx::Point(click))) { | 
 |  109     // Use the default implementation for any other command. | 
 |  110     CustomFrameWindow::OnSysCommand(notification_code, click); | 
 |  111   } | 
 |  112 } | 
 |  113  | 
 |  114 /////////////////////////////////////////////////////////////////////////////// | 
 |  115 // EmbeddedFrame, private: | 
 |  116  | 
 |  117 EmbeddedNonClientView* EmbeddedFrame::GetEmbeddedNonClientView() const { | 
 |  118   // We can safely assume that this conversion is true. | 
 |  119   return static_cast<EmbeddedNonClientView*>(non_client_view_); | 
 |  120 } | 
 |  121  | 
| OLD | NEW |