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