OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/views/old_frames/vista_frame.h" | 5 #include "chrome/browser/views/old_frames/vista_frame.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlapp.h> | 9 #include <atlapp.h> |
10 #include <atltheme.h> | 10 #include <atltheme.h> |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 tabstrip_(NULL), | 121 tabstrip_(NULL), |
122 active_bookmark_bar_(NULL), | 122 active_bookmark_bar_(NULL), |
123 tab_contents_container_(NULL), | 123 tab_contents_container_(NULL), |
124 custom_window_enabled_(false), | 124 custom_window_enabled_(false), |
125 saved_window_placement_(false), | 125 saved_window_placement_(false), |
126 on_mouse_leave_armed_(false), | 126 on_mouse_leave_armed_(false), |
127 in_drag_session_(false), | 127 in_drag_session_(false), |
128 shelf_view_(NULL), | 128 shelf_view_(NULL), |
129 bookmark_bar_view_(NULL), | 129 bookmark_bar_view_(NULL), |
130 info_bar_view_(NULL), | 130 info_bar_view_(NULL), |
| 131 needs_layout_(false), |
131 is_off_the_record_(false), | 132 is_off_the_record_(false), |
132 off_the_record_image_(NULL), | 133 off_the_record_image_(NULL), |
133 distributor_logo_(NULL), | 134 distributor_logo_(NULL), |
134 ignore_ncactivate_(false), | 135 ignore_ncactivate_(false), |
135 should_save_window_placement_(browser->GetType() != BrowserType::BROWSER), | 136 should_save_window_placement_(browser->GetType() != BrowserType::BROWSER), |
136 browser_view_(NULL) { | 137 browser_view_(NULL) { |
137 InitializeIfNeeded(); | 138 InitializeIfNeeded(); |
138 } | 139 } |
139 | 140 |
140 void VistaFrame::InitializeIfNeeded() { | 141 void VistaFrame::InitializeIfNeeded() { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 ResetDWMFrame(); | 380 ResetDWMFrame(); |
380 | 381 |
381 tab_contents_container_->SetBounds(browser_x, | 382 tab_contents_container_->SetBounds(browser_x, |
382 browser_y, | 383 browser_y, |
383 browser_w, | 384 browser_w, |
384 browser_h); | 385 browser_h); |
385 | 386 |
386 browser_view_->LayoutStatusBubble(browser_y + browser_h); | 387 browser_view_->LayoutStatusBubble(browser_y + browser_h); |
387 | 388 |
388 frame_view_->SchedulePaint(); | 389 frame_view_->SchedulePaint(); |
| 390 needs_layout_ = false; |
389 } | 391 } |
390 | 392 |
391 //////////////////////////////////////////////////////////////////////////////// | 393 //////////////////////////////////////////////////////////////////////////////// |
392 // | 394 // |
393 // BrowserWindow implementation | 395 // BrowserWindow implementation |
394 // | 396 // |
395 //////////////////////////////////////////////////////////////////////////////// | 397 //////////////////////////////////////////////////////////////////////////////// |
396 | 398 |
397 void VistaFrame::Init() { | 399 void VistaFrame::Init() { |
398 FrameUtil::RegisterBrowserWindow(this); | 400 FrameUtil::RegisterBrowserWindow(this); |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 bookmark_bar_view_.reset(NULL); | 1602 bookmark_bar_view_.reset(NULL); |
1601 | 1603 |
1602 browser_->tabstrip_model()->RemoveObserver(tabstrip_); | 1604 browser_->tabstrip_model()->RemoveObserver(tabstrip_); |
1603 delete browser_; | 1605 delete browser_; |
1604 browser_ = NULL; | 1606 browser_ = NULL; |
1605 } | 1607 } |
1606 } | 1608 } |
1607 | 1609 |
1608 void VistaFrame::ShelfVisibilityChangedImpl(TabContents* current_tab) { | 1610 void VistaFrame::ShelfVisibilityChangedImpl(TabContents* current_tab) { |
1609 // Coalesce layouts. | 1611 // Coalesce layouts. |
1610 bool changed = false; | |
1611 | |
1612 ChromeViews::View* new_shelf = NULL; | 1612 ChromeViews::View* new_shelf = NULL; |
1613 if (current_tab && current_tab->IsDownloadShelfVisible()) | 1613 if (current_tab && current_tab->IsDownloadShelfVisible()) |
1614 new_shelf = current_tab->GetDownloadShelfView(); | 1614 new_shelf = current_tab->GetDownloadShelfView(); |
1615 changed |= UpdateChildViewAndLayout(new_shelf, &shelf_view_); | 1615 needs_layout_ |= UpdateChildViewAndLayout(new_shelf, &shelf_view_); |
1616 | 1616 |
1617 ChromeViews::View* new_info_bar = NULL; | 1617 ChromeViews::View* new_info_bar = NULL; |
1618 WebContents* web_contents = current_tab ? current_tab->AsWebContents() : NULL; | 1618 WebContents* web_contents = current_tab ? current_tab->AsWebContents() : NULL; |
1619 if (web_contents && web_contents->view()->IsInfoBarVisible()) | 1619 if (web_contents && web_contents->view()->IsInfoBarVisible()) |
1620 new_info_bar = web_contents->view()->GetInfoBarView(); | 1620 new_info_bar = web_contents->view()->GetInfoBarView(); |
1621 changed |= UpdateChildViewAndLayout(new_info_bar, &info_bar_view_); | 1621 needs_layout_ |= UpdateChildViewAndLayout(new_info_bar, &info_bar_view_); |
1622 | 1622 |
1623 ChromeViews::View* new_bookmark_bar_view = NULL; | 1623 ChromeViews::View* new_bookmark_bar_view = NULL; |
1624 if (SupportsBookmarkBar()) | 1624 if (SupportsBookmarkBar()) |
1625 new_bookmark_bar_view = GetBookmarkBarView(); | 1625 new_bookmark_bar_view = GetBookmarkBarView(); |
1626 changed |= UpdateChildViewAndLayout(new_bookmark_bar_view, | 1626 needs_layout_ |= UpdateChildViewAndLayout(new_bookmark_bar_view, |
1627 &active_bookmark_bar_); | 1627 &active_bookmark_bar_); |
1628 | 1628 |
1629 // Only do a layout if the current contents is non-null. We assume that if the | 1629 // Only do a layout if the current contents is non-null. We assume that if the |
1630 // contents is NULL, we're either being destroyed, or ShowTabContents is going | 1630 // contents is NULL, we're either being destroyed, or ShowTabContents is going |
1631 // to be invoked with a non-null TabContents again so that there is no need | 1631 // to be invoked with a non-null TabContents again so that there is no need |
1632 // in doing a layout now (and would result in extra work/invalidation on | 1632 // in doing a layout now (and would result in extra work/invalidation on |
1633 // tab switches). | 1633 // tab switches). |
1634 if (changed && current_tab) | 1634 if (needs_layout_ && current_tab) |
1635 Layout(); | 1635 Layout(); |
1636 } | 1636 } |
OLD | NEW |