Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/chromeos/notifications/system_notification.cc

Issue 3412033: Make feedback failure notification non sticky (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: " Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/notifications/system_notification.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/chromeos/notifications/system_notification.h" 5 #include "chrome/browser/chromeos/notifications/system_notification.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/move.h" 9 #include "base/move.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 21 matching lines...) Expand all
32 base::Base64Encode(str_gurl, &str_gurl); 32 base::Base64Encode(str_gurl, &str_gurl);
33 str_gurl.insert(0, "data:image/png;base64,"); 33 str_gurl.insert(0, "data:image/png;base64,");
34 GURL tmp_gurl(str_gurl); 34 GURL tmp_gurl(str_gurl);
35 icon_.Swap(&tmp_gurl); 35 icon_.Swap(&tmp_gurl);
36 } 36 }
37 37
38 SystemNotification::~SystemNotification() { 38 SystemNotification::~SystemNotification() {
39 Hide(); 39 Hide();
40 } 40 }
41 41
42 void SystemNotification::Show(const string16& message, bool urgent) { 42 void SystemNotification::Show(const string16& message,
43 bool urgent,
44 bool sticky) {
43 Notification notify = SystemNotificationFactory::Create(icon_, 45 Notification notify = SystemNotificationFactory::Create(icon_,
44 title_, message, delegate_.get()); 46 title_, message, delegate_.get());
45 if (visible_) { 47 if (visible_) {
46 // Force showing a user hidden notification on an urgent transition. 48 // Force showing a user hidden notification on an urgent transition.
47 if (urgent && !urgent_) { 49 if (urgent && !urgent_) {
48 collection_->UpdateAndShowNotification(notify); 50 collection_->UpdateAndShowNotification(notify);
49 } else { 51 } else {
50 collection_->UpdateNotification(notify); 52 collection_->UpdateNotification(notify);
51 } 53 }
52 } else { 54 } else {
53 collection_->AddSystemNotification(notify, profile_, true /* sticky */, 55 collection_->AddSystemNotification(notify, profile_,
56 sticky,
54 false /* no controls */); 57 false /* no controls */);
55 } 58 }
56 visible_ = true; 59 visible_ = true;
57 urgent_ = urgent; 60 urgent_ = urgent;
58 } 61 }
59 62
60 void SystemNotification::Hide() { 63 void SystemNotification::Hide() {
61 if (visible_) { 64 if (visible_) {
62 collection_->Remove(Notification(GURL(), GURL(), string16(), string16(), 65 collection_->Remove(Notification(GURL(), GURL(), string16(), string16(),
63 delegate_.get())); 66 delegate_.get()));
64 67
65 visible_ = false; 68 visible_ = false;
66 urgent_ = false; 69 urgent_ = false;
67 } 70 }
68 } 71 }
69 72
70 } // namespace chromeos 73 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/notifications/system_notification.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698