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

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

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

Powered by Google App Engine
This is Rietveld 408576698