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

Side by Side Diff: chrome/browser/notifications/balloon_collection_win.cc

Issue 338051: Adds UI components for desktop notifications, including balloon view classes ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: use notused.png resources for try servers Created 11 years, 1 month 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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/notifications/balloon_collection.h"
6
7 #include "base/gfx/rect.h"
8 #include "base/logging.h"
9 #include "base/stl_util-inl.h"
10 #include "chrome/browser/notifications/balloon.h"
11 #include "chrome/browser/views/notifications/balloon_view.h"
12
13 namespace {
14
15 void GetMainScreenWorkArea(gfx::Rect* bounds) {
16 DCHECK(bounds);
17 RECT work_area = {0};
18 if (::SystemParametersInfo(SPI_GETWORKAREA, 0, &work_area, 0)) {
19 bounds->SetRect(work_area.left, work_area.top,
20 work_area.right, work_area.bottom);
21 } else {
22 // If call to ::SystemParametersInfo fails for some reason, we simply get
23 // the full screen size as an alternative.
24 bounds->SetRect(0, 0,
25 ::GetSystemMetrics(SM_CXSCREEN) - 1,
26 ::GetSystemMetrics(SM_CYSCREEN) - 1);
27 }
28 }
29
30 } // namespace
31
32 Balloon* BalloonCollectionImpl::MakeBalloon(const Notification& notification,
33 Profile* profile) {
34 Balloon* balloon = new Balloon(notification, profile, this);
35 balloon->set_view(new BalloonViewImpl());
36 gfx::Size size(layout_.min_balloon_width(), layout_.min_balloon_height());
37 balloon->set_size(size);
38 return balloon;
39 }
40
41 bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() {
42 bool changed = false;
43
44 gfx::Rect new_work_area(work_area_.x(), work_area_.y(),
45 work_area_.width(), work_area_.height());
46 GetMainScreenWorkArea(&new_work_area);
47 if (!work_area_.Equals(new_work_area)) {
48 work_area_.SetRect(new_work_area.x(), new_work_area.y(),
49 new_work_area.width(), new_work_area.height());
50 changed = true;
51 }
52
53 return changed;
54 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/balloon_collection_mac.mm ('k') | chrome/browser/notifications/balloons.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698