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

Side by Side Diff: ash/shell/window_type_launcher.cc

Issue 10546125: Add WebNotificationTray to the status area (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "ash/shell/window_type_launcher.h" 5 #include "ash/shell/window_type_launcher.h"
6 6
7 #include "ash/screensaver/screensaver_view.h" 7 #include "ash/screensaver/screensaver_view.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell/example_factory.h" 9 #include "ash/shell/example_factory.h"
10 #include "ash/shell/panel_window.h" 10 #include "ash/shell/panel_window.h"
11 #include "ash/shell/toplevel_window.h" 11 #include "ash/shell/toplevel_window.h"
12 #include "ash/shell_delegate.h" 12 #include "ash/shell_delegate.h"
13 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
14 #include "ash/system/status_area_widget.h"
15 #include "ash/system/web_notification/web_notification_tray.h"
14 #include "ash/wm/shadow_types.h" 16 #include "ash/wm/shadow_types.h"
15 #include "base/bind.h" 17 #include "base/bind.h"
16 #include "base/time.h" 18 #include "base/time.h"
17 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
18 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
19 #include "ui/aura/root_window.h" 21 #include "ui/aura/root_window.h"
20 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
21 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
22 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
23 #include "ui/views/controls/button/text_button.h" 25 #include "ui/views/controls/button/text_button.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 new views::NativeTextButton( 218 new views::NativeTextButton(
217 this, ASCIIToUTF16("Open Non-Modal Transient Window")))), 219 this, ASCIIToUTF16("Open Non-Modal Transient Window")))),
218 ALLOW_THIS_IN_INITIALIZER_LIST(examples_button_( 220 ALLOW_THIS_IN_INITIALIZER_LIST(examples_button_(
219 new views::NativeTextButton( 221 new views::NativeTextButton(
220 this, ASCIIToUTF16("Open Views Examples Window")))), 222 this, ASCIIToUTF16("Open Views Examples Window")))),
221 ALLOW_THIS_IN_INITIALIZER_LIST(show_hide_window_button_( 223 ALLOW_THIS_IN_INITIALIZER_LIST(show_hide_window_button_(
222 new views::NativeTextButton( 224 new views::NativeTextButton(
223 this, ASCIIToUTF16("Show/Hide a Window")))), 225 this, ASCIIToUTF16("Show/Hide a Window")))),
224 ALLOW_THIS_IN_INITIALIZER_LIST(show_screensaver_( 226 ALLOW_THIS_IN_INITIALIZER_LIST(show_screensaver_(
225 new views::NativeTextButton( 227 new views::NativeTextButton(
226 this, ASCIIToUTF16("Show the Screensaver [for 5 seconds]")))) { 228 this, ASCIIToUTF16("Show the Screensaver [for 5 seconds]")))),
229 ALLOW_THIS_IN_INITIALIZER_LIST(show_web_notification_(
230 new views::NativeTextButton(
231 this, ASCIIToUTF16("Show a web/app notification")))) {
227 views::GridLayout* layout = new views::GridLayout(this); 232 views::GridLayout* layout = new views::GridLayout(this);
228 layout->SetInsets(5, 5, 5, 5); 233 layout->SetInsets(5, 5, 5, 5);
229 SetLayoutManager(layout); 234 SetLayoutManager(layout);
230 views::ColumnSet* column_set = layout->AddColumnSet(0); 235 views::ColumnSet* column_set = layout->AddColumnSet(0);
231 column_set->AddColumn(views::GridLayout::LEADING, 236 column_set->AddColumn(views::GridLayout::LEADING,
232 views::GridLayout::CENTER, 237 views::GridLayout::CENTER,
233 0, 238 0,
234 views::GridLayout::USE_PREF, 239 views::GridLayout::USE_PREF,
235 0, 240 0,
236 0); 241 0);
237 AddViewToLayout(layout, create_button_); 242 AddViewToLayout(layout, create_button_);
238 AddViewToLayout(layout, create_persistant_button_); 243 AddViewToLayout(layout, create_persistant_button_);
239 AddViewToLayout(layout, panel_button_); 244 AddViewToLayout(layout, panel_button_);
240 AddViewToLayout(layout, create_nonresizable_button_); 245 AddViewToLayout(layout, create_nonresizable_button_);
241 AddViewToLayout(layout, bubble_button_); 246 AddViewToLayout(layout, bubble_button_);
242 AddViewToLayout(layout, lock_button_); 247 AddViewToLayout(layout, lock_button_);
243 AddViewToLayout(layout, widgets_button_); 248 AddViewToLayout(layout, widgets_button_);
244 AddViewToLayout(layout, system_modal_button_); 249 AddViewToLayout(layout, system_modal_button_);
245 AddViewToLayout(layout, window_modal_button_); 250 AddViewToLayout(layout, window_modal_button_);
246 AddViewToLayout(layout, transient_button_); 251 AddViewToLayout(layout, transient_button_);
247 AddViewToLayout(layout, examples_button_); 252 AddViewToLayout(layout, examples_button_);
248 AddViewToLayout(layout, show_hide_window_button_); 253 AddViewToLayout(layout, show_hide_window_button_);
249 AddViewToLayout(layout, show_screensaver_); 254 AddViewToLayout(layout, show_screensaver_);
255 AddViewToLayout(layout, show_web_notification_);
250 #if !defined(OS_MACOSX) 256 #if !defined(OS_MACOSX)
251 set_context_menu_controller(this); 257 set_context_menu_controller(this);
252 #endif 258 #endif
253 } 259 }
254 260
255 WindowTypeLauncher::~WindowTypeLauncher() { 261 WindowTypeLauncher::~WindowTypeLauncher() {
256 } 262 }
257 263
258 void WindowTypeLauncher::OnPaint(gfx::Canvas* canvas) { 264 void WindowTypeLauncher::OnPaint(gfx::Canvas* canvas) {
259 canvas->FillRect(GetLocalBounds(), SK_ColorWHITE); 265 canvas->FillRect(GetLocalBounds(), SK_ColorWHITE);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 NonModalTransient::OpenNonModalTransient(GetWidget()->GetNativeView()); 319 NonModalTransient::OpenNonModalTransient(GetWidget()->GetNativeView());
314 } else if (sender == show_hide_window_button_) { 320 } else if (sender == show_hide_window_button_) {
315 NonModalTransient::ToggleNonModalTransient(GetWidget()->GetNativeView()); 321 NonModalTransient::ToggleNonModalTransient(GetWidget()->GetNativeView());
316 } else if (sender == show_screensaver_) { 322 } else if (sender == show_screensaver_) {
317 ash::ShowScreensaver(GURL("http://www.google.com")); 323 ash::ShowScreensaver(GURL("http://www.google.com"));
318 content::BrowserThread::PostDelayedTask(content::BrowserThread::UI, 324 content::BrowserThread::PostDelayedTask(content::BrowserThread::UI,
319 FROM_HERE, 325 FROM_HERE,
320 base::Bind(&ash::CloseScreensaver), 326 base::Bind(&ash::CloseScreensaver),
321 base::TimeDelta::FromSeconds(5)); 327 base::TimeDelta::FromSeconds(5));
322 328
329 } else if (sender == show_web_notification_) {
330 ash::Shell::GetInstance()->status_area_widget()->
331 web_notification_tray()->AddNotification(
332 "id0",
333 ASCIIToUTF16("Test Shell Web Notification"),
334 ASCIIToUTF16("Notification message body."),
335 ASCIIToUTF16("www.testshell.org"),
336 "" /* extension id */);
323 } 337 }
324 #if !defined(OS_MACOSX) 338 #if !defined(OS_MACOSX)
325 else if (sender == examples_button_) { 339 else if (sender == examples_button_) {
326 views::examples::ShowExamplesWindow( 340 views::examples::ShowExamplesWindow(
327 views::examples::DO_NOTHING_ON_CLOSE, 341 views::examples::DO_NOTHING_ON_CLOSE,
328 ash::Shell::GetInstance()->browser_context()); 342 ash::Shell::GetInstance()->browser_context());
329 } 343 }
330 #endif // !defined(OS_MACOSX) 344 #endif // !defined(OS_MACOSX)
331 } 345 }
332 346
(...skipping 26 matching lines...) Expand all
359 menu_runner_.reset(new MenuRunner(root)); 373 menu_runner_.reset(new MenuRunner(root));
360 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(point, gfx::Size()), 374 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(point, gfx::Size()),
361 MenuItemView::TOPLEFT, 375 MenuItemView::TOPLEFT,
362 MenuRunner::HAS_MNEMONICS) == MenuRunner::MENU_DELETED) 376 MenuRunner::HAS_MNEMONICS) == MenuRunner::MENU_DELETED)
363 return; 377 return;
364 } 378 }
365 #endif // !defined(OS_MACOSX) 379 #endif // !defined(OS_MACOSX)
366 380
367 } // namespace shell 381 } // namespace shell
368 } // namespace ash 382 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698