| 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/xp_frame.h" | 5 #include "chrome/browser/views/old_frames/xp_frame.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/gfx/native_theme.h" | 10 #include "base/gfx/native_theme.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 current_action_(FA_NONE), | 333 current_action_(FA_NONE), |
| 334 on_mouse_leave_armed_(false), | 334 on_mouse_leave_armed_(false), |
| 335 previous_cursor_(NULL), | 335 previous_cursor_(NULL), |
| 336 minimum_size_(100, 100), | 336 minimum_size_(100, 100), |
| 337 shelf_view_(NULL), | 337 shelf_view_(NULL), |
| 338 bookmark_bar_view_(NULL), | 338 bookmark_bar_view_(NULL), |
| 339 info_bar_view_(NULL), | 339 info_bar_view_(NULL), |
| 340 is_active_(false), | 340 is_active_(false), |
| 341 is_off_the_record_(false), | 341 is_off_the_record_(false), |
| 342 title_bar_height_(0), | 342 title_bar_height_(0), |
| 343 needs_layout_(false), |
| 343 off_the_record_image_(NULL), | 344 off_the_record_image_(NULL), |
| 344 distributor_logo_(NULL), | 345 distributor_logo_(NULL), |
| 345 ignore_ncactivate_(false), | 346 ignore_ncactivate_(false), |
| 346 #ifdef CHROME_PERSONALIZATION | 347 #ifdef CHROME_PERSONALIZATION |
| 347 personalization_enabled_(false), | 348 personalization_enabled_(false), |
| 348 personalization_(NULL), | 349 personalization_(NULL), |
| 349 #endif | 350 #endif |
| 350 paint_as_active_(false), | 351 paint_as_active_(false), |
| 351 browser_view_(NULL) { | 352 browser_view_(NULL) { |
| 352 InitializeIfNeeded(); | 353 InitializeIfNeeded(); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 #ifdef CHROME_PERSONALIZATION | 830 #ifdef CHROME_PERSONALIZATION |
| 830 if (PersonalizationEnabled()) { | 831 if (PersonalizationEnabled()) { |
| 831 Personalization::ConfigureFramePersonalization(personalization_, | 832 Personalization::ConfigureFramePersonalization(personalization_, |
| 832 browser_view_, top_margin); | 833 browser_view_, top_margin); |
| 833 } | 834 } |
| 834 #endif | 835 #endif |
| 835 | 836 |
| 836 browser_view_->LayoutStatusBubble(last_y + browser_h); | 837 browser_view_->LayoutStatusBubble(last_y + browser_h); |
| 837 | 838 |
| 838 frame_view_->SchedulePaint(); | 839 frame_view_->SchedulePaint(); |
| 840 needs_layout_ = false; |
| 839 } | 841 } |
| 840 | 842 |
| 841 // This is called when we receive WM_ENDSESSION. We have 5 seconds to quit | 843 // This is called when we receive WM_ENDSESSION. We have 5 seconds to quit |
| 842 // the application or we are going to be flagged as flaky. | 844 // the application or we are going to be flagged as flaky. |
| 843 void XPFrame::OnEndSession(BOOL ending, UINT logoff) { | 845 void XPFrame::OnEndSession(BOOL ending, UINT logoff) { |
| 844 tabstrip_->AbortActiveDragSession(); | 846 tabstrip_->AbortActiveDragSession(); |
| 845 FrameUtil::EndSession(); | 847 FrameUtil::EndSession(); |
| 846 } | 848 } |
| 847 | 849 |
| 848 // Note: called directly by the handler macros to handle WM_CLOSE messages. | 850 // Note: called directly by the handler macros to handle WM_CLOSE messages. |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2477 bookmark_bar_view_.reset(NULL); | 2479 bookmark_bar_view_.reset(NULL); |
| 2478 | 2480 |
| 2479 browser_->tabstrip_model()->RemoveObserver(tabstrip_); | 2481 browser_->tabstrip_model()->RemoveObserver(tabstrip_); |
| 2480 delete browser_; | 2482 delete browser_; |
| 2481 browser_ = NULL; | 2483 browser_ = NULL; |
| 2482 } | 2484 } |
| 2483 } | 2485 } |
| 2484 | 2486 |
| 2485 void XPFrame::ShelfVisibilityChangedImpl(TabContents* current_tab) { | 2487 void XPFrame::ShelfVisibilityChangedImpl(TabContents* current_tab) { |
| 2486 // Coalesce layouts. | 2488 // Coalesce layouts. |
| 2487 bool changed = false; | |
| 2488 | |
| 2489 ChromeViews::View* new_shelf = NULL; | 2489 ChromeViews::View* new_shelf = NULL; |
| 2490 if (current_tab && current_tab->IsDownloadShelfVisible()) | 2490 if (current_tab && current_tab->IsDownloadShelfVisible()) |
| 2491 new_shelf = current_tab->GetDownloadShelfView(); | 2491 new_shelf = current_tab->GetDownloadShelfView(); |
| 2492 changed |= UpdateChildViewAndLayout(new_shelf, &shelf_view_); | 2492 needs_layout_ |= UpdateChildViewAndLayout(new_shelf, &shelf_view_); |
| 2493 | 2493 |
| 2494 ChromeViews::View* new_info_bar = NULL; | 2494 ChromeViews::View* new_info_bar = NULL; |
| 2495 WebContents* web_contents = current_tab ? current_tab->AsWebContents() : NULL; | 2495 WebContents* web_contents = current_tab ? current_tab->AsWebContents() : NULL; |
| 2496 if (web_contents && web_contents->view()->IsInfoBarVisible()) | 2496 if (web_contents && web_contents->view()->IsInfoBarVisible()) |
| 2497 new_info_bar = web_contents->view()->GetInfoBarView(); | 2497 new_info_bar = web_contents->view()->GetInfoBarView(); |
| 2498 changed |= UpdateChildViewAndLayout(new_info_bar, &info_bar_view_); | 2498 needs_layout_ |= UpdateChildViewAndLayout(new_info_bar, &info_bar_view_); |
| 2499 | 2499 |
| 2500 ChromeViews::View* new_bookmark_bar_view = NULL; | 2500 ChromeViews::View* new_bookmark_bar_view = NULL; |
| 2501 if (SupportsBookmarkBar()) | 2501 if (SupportsBookmarkBar()) |
| 2502 new_bookmark_bar_view = GetBookmarkBarView(); | 2502 new_bookmark_bar_view = GetBookmarkBarView(); |
| 2503 changed |= UpdateChildViewAndLayout(new_bookmark_bar_view, | 2503 needs_layout_ |= UpdateChildViewAndLayout(new_bookmark_bar_view, |
| 2504 &active_bookmark_bar_); | 2504 &active_bookmark_bar_); |
| 2505 | 2505 |
| 2506 // Only do a layout if the current contents is non-null. We assume that if the | 2506 // Only do a layout if the current contents is non-null. We assume that if the |
| 2507 // contents is NULL, we're either being destroyed, or ShowTabContents is going | 2507 // contents is NULL, we're either being destroyed, or ShowTabContents is going |
| 2508 // to be invoked with a non-null TabContents again so that there is no need | 2508 // to be invoked with a non-null TabContents again so that there is no need |
| 2509 // in doing a layout now (and would result in extra work/invalidation on | 2509 // in doing a layout now (and would result in extra work/invalidation on |
| 2510 // tab switches). | 2510 // tab switches). |
| 2511 if (changed && current_tab) | 2511 if (needs_layout_ && current_tab) |
| 2512 Layout(); | 2512 Layout(); |
| 2513 } | 2513 } |
| 2514 | |
| OLD | NEW |