download_shelf.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 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/download/download_shelf.h" 6 7DownloadShelf::DownloadShelf() 8 : should_show_on_unhide_(false), 9 is_hidden_(false) {} 10 11void DownloadShelf::AddDownload(BaseDownloadItemModel* download_model) { 12 if (is_hidden_) 13 Unhide(); 14 Show(); 15 DoAddDownload(download_model); 16} 17 18void DownloadShelf::Show() { 19 if (is_hidden_) { 20 should_show_on_unhide_ = true; 21 return; 22 } 23 DoShow(); 24} 25 26void DownloadShelf::Close() { 27 if (is_hidden_) { 28 should_show_on_unhide_ = false; 29 return; 30 } 31 DoClose(); 32} 33 34void DownloadShelf::Hide() { 35 if (is_hidden_) 36 return; 37 is_hidden_ = true; 38 if (IsShowing()) { 39 should_show_on_unhide_ = true; 40 DoClose(); 41 } 42} 43 44void DownloadShelf::Unhide() { 45 if (!is_hidden_) 46 return; 47 is_hidden_ = false; 48 if (should_show_on_unhide_) { 49 should_show_on_unhide_ = false; 50 DoShow(); 51 } 52} 53