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

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views.cc

Issue 616253002: Extract NativeAppWindow from src/extensions Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: might fix athena. similarity=33 Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/views/apps/chrome_native_app_window_views.h" 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h"
6 6
7 #include "apps/ui/views/app_window_frame_view.h" 7 #include "apps/ui/views/app_window_frame_view.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/app_mode/app_mode_utils.h" 10 #include "chrome/browser/app_mode/app_mode_utils.h"
11 #include "chrome/browser/chrome_page_zoom.h" 11 #include "chrome/browser/chrome_page_zoom.h"
12 #include "chrome/browser/favicon/favicon_tab_helper.h" 12 #include "chrome/browser/favicon/favicon_tab_helper.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/host_desktop.h" 14 #include "chrome/browser/ui/host_desktop.h"
15 #include "chrome/browser/ui/views/apps/shaped_app_window_targeter.h" 15 #include "chrome/browser/ui/views/apps/shaped_app_window_targeter.h"
16 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h" 16 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h"
17 #include "chrome/browser/ui/views/frame/taskbar_decorator.h" 17 #include "chrome/browser/ui/views/frame/taskbar_decorator.h"
18 #include "chrome/browser/ui/zoom/zoom_controller.h" 18 #include "chrome/browser/ui/zoom/zoom_controller.h"
19 #include "chrome/browser/web_applications/web_app.h" 19 #include "chrome/browser/web_applications/web_app.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "extensions/browser/app_window/app_window.h"
21 #include "extensions/common/extension.h" 22 #include "extensions/common/extension.h"
22 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
23 #include "ui/base/hit_test.h" 24 #include "ui/base/hit_test.h"
24 #include "ui/base/models/simple_menu_model.h" 25 #include "ui/base/models/simple_menu_model.h"
25 #include "ui/gfx/image/image_skia.h" 26 #include "ui/gfx/image/image_skia.h"
26 #include "ui/views/controls/menu/menu_runner.h" 27 #include "ui/views/controls/menu/menu_runner.h"
27 #include "ui/views/controls/webview/webview.h" 28 #include "ui/views/controls/webview/webview.h"
28 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
29 #include "ui/wm/core/easy_resize_window_targeter.h" 30 #include "ui/wm/core/easy_resize_window_targeter.h"
30 #include "ui/wm/core/shadow_types.h" 31 #include "ui/wm/core/shadow_types.h"
(...skipping 18 matching lines...) Expand all
49 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" 50 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h"
50 #include "ui/aura/client/aura_constants.h" 51 #include "ui/aura/client/aura_constants.h"
51 #include "ui/aura/client/window_tree_client.h" 52 #include "ui/aura/client/window_tree_client.h"
52 #include "ui/aura/window_observer.h" 53 #include "ui/aura/window_observer.h"
53 #endif 54 #endif
54 55
55 #if defined(OS_CHROMEOS) 56 #if defined(OS_CHROMEOS)
56 #include "ash/shell_window_ids.h" 57 #include "ash/shell_window_ids.h"
57 #endif 58 #endif
58 59
59 using extensions::AppWindow;
60
61 namespace { 60 namespace {
62 61
63 const int kMinPanelWidth = 100; 62 const int kMinPanelWidth = 100;
64 const int kMinPanelHeight = 100; 63 const int kMinPanelHeight = 100;
65 const int kDefaultPanelWidth = 200; 64 const int kDefaultPanelWidth = 200;
66 const int kDefaultPanelHeight = 300; 65 const int kDefaultPanelHeight = 300;
67 66
68 struct AcceleratorMapping { 67 struct AcceleratorMapping {
69 ui::KeyboardCode keycode; 68 ui::KeyboardCode keycode;
70 int modifiers; 69 int modifiers;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 120 }
122 return accelerators; 121 return accelerators;
123 } 122 }
124 123
125 #if defined(USE_ASH) 124 #if defined(USE_ASH)
126 // This class handles a user's fullscreen request (Shift+F4/F4). 125 // This class handles a user's fullscreen request (Shift+F4/F4).
127 class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate, 126 class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate,
128 public ash::wm::WindowStateObserver, 127 public ash::wm::WindowStateObserver,
129 public aura::WindowObserver { 128 public aura::WindowObserver {
130 public: 129 public:
131 NativeAppWindowStateDelegate(AppWindow* app_window, 130 NativeAppWindowStateDelegate(
132 extensions::NativeAppWindow* native_app_window) 131 extensions::AppWindow* app_window,
132 native_app_window::NativeAppWindow* native_app_window)
133 : app_window_(app_window), 133 : app_window_(app_window),
134 window_state_( 134 window_state_(
135 ash::wm::GetWindowState(native_app_window->GetNativeWindow())) { 135 ash::wm::GetWindowState(native_app_window->GetNativeWindow())) {
136 // Add a window state observer to exit fullscreen properly in case 136 // Add a window state observer to exit fullscreen properly in case
137 // fullscreen is exited without going through AppWindow::Restore(). This 137 // fullscreen is exited without going through AppWindow::Restore(). This
138 // is the case when exiting immersive fullscreen via the "Restore" window 138 // is the case when exiting immersive fullscreen via the "Restore" window
139 // control. 139 // control.
140 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 140 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048
141 window_state_->AddObserver(this); 141 window_state_->AddObserver(this);
142 window_state_->window()->AddObserver(this); 142 window_state_->window()->AddObserver(this);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 180
181 // Overridden from aura::WindowObserver: 181 // Overridden from aura::WindowObserver:
182 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { 182 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
183 window_state_->RemoveObserver(this); 183 window_state_->RemoveObserver(this);
184 window_state_->window()->RemoveObserver(this); 184 window_state_->window()->RemoveObserver(this);
185 window_state_ = NULL; 185 window_state_ = NULL;
186 } 186 }
187 187
188 // Not owned. 188 // Not owned.
189 AppWindow* app_window_; 189 extensions::AppWindow* app_window_;
190 ash::wm::WindowState* window_state_; 190 ash::wm::WindowState* window_state_;
191 191
192 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowStateDelegate); 192 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowStateDelegate);
193 }; 193 };
194 #endif // USE_ASH 194 #endif // USE_ASH
195 195
196 } // namespace 196 } // namespace
197 197
198 ChromeNativeAppWindowViews::ChromeNativeAppWindowViews() 198 ChromeNativeAppWindowViews::ChromeNativeAppWindowViews(
199 extensions::AppWindow* extensions_app_window)
199 : is_fullscreen_(false), 200 : is_fullscreen_(false),
200 has_frame_color_(false), 201 has_frame_color_(false),
201 active_frame_color_(SK_ColorBLACK), 202 active_frame_color_(SK_ColorBLACK),
202 inactive_frame_color_(SK_ColorBLACK) { 203 inactive_frame_color_(SK_ColorBLACK),
204 extensions_app_window_(extensions_app_window) {
203 } 205 }
204 206
205 ChromeNativeAppWindowViews::~ChromeNativeAppWindowViews() {} 207 ChromeNativeAppWindowViews::~ChromeNativeAppWindowViews() {}
206 208
207 void ChromeNativeAppWindowViews::OnBeforeWidgetInit( 209 void ChromeNativeAppWindowViews::OnBeforeWidgetInit(
208 views::Widget::InitParams* init_params, 210 views::Widget::InitParams* init_params,
209 views::Widget* widget) {} 211 views::Widget* widget) {}
210 212
211 void ChromeNativeAppWindowViews::InitializeDefaultWindow( 213 void ChromeNativeAppWindowViews::InitializeDefaultWindow(
212 const AppWindow::CreateParams& create_params) { 214 const native_app_window::AppWindowCreateParams& create_params) {
213 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( 215 std::string app_name = web_app::GenerateApplicationNameFromExtensionId(
214 app_window()->extension_id()); 216 extensions_app_window_->extension_id());
215 217
216 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW); 218 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW);
217 init_params.delegate = this; 219 init_params.delegate = this;
218 init_params.remove_standard_frame = IsFrameless() || has_frame_color_; 220 init_params.remove_standard_frame = IsFrameless() || has_frame_color_;
219 init_params.use_system_default_icon = true; 221 init_params.use_system_default_icon = true;
220 if (create_params.alpha_enabled) 222 if (create_params.alpha_enabled)
221 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 223 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
222 init_params.keep_on_top = create_params.always_on_top; 224 init_params.keep_on_top = create_params.always_on_top;
223 init_params.visible_on_all_workspaces = 225 init_params.visible_on_all_workspaces =
224 create_params.visible_on_all_workspaces; 226 create_params.visible_on_all_workspaces;
(...skipping 18 matching lines...) Expand all
243 #endif 245 #endif
244 widget()->Init(init_params); 246 widget()->Init(init_params);
245 247
246 // The frame insets are required to resolve the bounds specifications 248 // The frame insets are required to resolve the bounds specifications
247 // correctly. So we set the window bounds and constraints now. 249 // correctly. So we set the window bounds and constraints now.
248 gfx::Insets frame_insets = GetFrameInsets(); 250 gfx::Insets frame_insets = GetFrameInsets();
249 gfx::Rect window_bounds = create_params.GetInitialWindowBounds(frame_insets); 251 gfx::Rect window_bounds = create_params.GetInitialWindowBounds(frame_insets);
250 SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets), 252 SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets),
251 create_params.GetContentMaximumSize(frame_insets)); 253 create_params.GetContentMaximumSize(frame_insets));
252 if (!window_bounds.IsEmpty()) { 254 if (!window_bounds.IsEmpty()) {
253 typedef AppWindow::BoundsSpecification BoundsSpecification; 255 typedef native_app_window::BoundsSpecification BoundsSpecification;
254 bool position_specified = 256 bool position_specified =
255 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && 257 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition &&
256 window_bounds.y() != BoundsSpecification::kUnspecifiedPosition; 258 window_bounds.y() != BoundsSpecification::kUnspecifiedPosition;
257 if (!position_specified) 259 if (!position_specified)
258 widget()->CenterWindow(window_bounds.size()); 260 widget()->CenterWindow(window_bounds.size());
259 else 261 else
260 widget()->SetBounds(window_bounds); 262 widget()->SetBounds(window_bounds);
261 } 263 }
262 264
263 if (IsFrameless() && 265 if (IsFrameless() &&
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 iter != accelerator_table.end(); ++iter) { 303 iter != accelerator_table.end(); ++iter) {
302 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second)) 304 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second))
303 continue; 305 continue;
304 306
305 focus_manager->RegisterAccelerator( 307 focus_manager->RegisterAccelerator(
306 iter->first, ui::AcceleratorManager::kNormalPriority, this); 308 iter->first, ui::AcceleratorManager::kNormalPriority, this);
307 } 309 }
308 } 310 }
309 311
310 void ChromeNativeAppWindowViews::InitializePanelWindow( 312 void ChromeNativeAppWindowViews::InitializePanelWindow(
311 const AppWindow::CreateParams& create_params) { 313 const native_app_window::AppWindowCreateParams& create_params) {
312 views::Widget::InitParams params(views::Widget::InitParams::TYPE_PANEL); 314 views::Widget::InitParams params(views::Widget::InitParams::TYPE_PANEL);
313 params.delegate = this; 315 params.delegate = this;
314 316
315 gfx::Rect initial_window_bounds = 317 gfx::Rect initial_window_bounds =
316 create_params.GetInitialWindowBounds(gfx::Insets()); 318 create_params.GetInitialWindowBounds(gfx::Insets());
317 preferred_size_ = gfx::Size(initial_window_bounds.width(), 319 preferred_size_ = gfx::Size(initial_window_bounds.width(),
318 initial_window_bounds.height()); 320 initial_window_bounds.height());
319 if (preferred_size_.width() == 0) 321 if (preferred_size_.width() == 0)
320 preferred_size_.set_width(kDefaultPanelWidth); 322 preferred_size_.set_width(kDefaultPanelWidth);
321 else if (preferred_size_.width() < kMinPanelWidth) 323 else if (preferred_size_.width() < kMinPanelWidth)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 case ui::SHOW_STATE_MINIMIZED: 441 case ui::SHOW_STATE_MINIMIZED:
440 case ui::SHOW_STATE_INACTIVE: 442 case ui::SHOW_STATE_INACTIVE:
441 case ui::SHOW_STATE_END: 443 case ui::SHOW_STATE_END:
442 return ui::SHOW_STATE_NORMAL; 444 return ui::SHOW_STATE_NORMAL;
443 } 445 }
444 #endif // !defined(USE_ASH) 446 #endif // !defined(USE_ASH)
445 return ui::SHOW_STATE_NORMAL; 447 return ui::SHOW_STATE_NORMAL;
446 } 448 }
447 449
448 bool ChromeNativeAppWindowViews::IsAlwaysOnTop() const { 450 bool ChromeNativeAppWindowViews::IsAlwaysOnTop() const {
449 if (app_window()->window_type_is_panel()) { 451 if (app_window()->WindowTypeIsPanel()) {
450 #if defined(USE_ASH) 452 #if defined(USE_ASH)
451 return ash::wm::GetWindowState(widget()->GetNativeWindow()) 453 return ash::wm::GetWindowState(widget()->GetNativeWindow())
452 ->panel_attached(); 454 ->panel_attached();
453 #else 455 #else
454 return true; 456 return true;
455 #endif 457 #endif
456 } else { 458 } else {
457 return widget()->IsAlwaysOnTop(); 459 return widget()->IsAlwaysOnTop();
458 } 460 }
459 } 461 }
(...skipping 28 matching lines...) Expand all
488 views::MenuRunner::MENU_DELETED) { 490 views::MenuRunner::MENU_DELETED) {
489 return; 491 return;
490 } 492 }
491 } 493 }
492 #endif 494 #endif
493 } 495 }
494 496
495 // views::WidgetDelegate implementation. 497 // views::WidgetDelegate implementation.
496 498
497 gfx::ImageSkia ChromeNativeAppWindowViews::GetWindowAppIcon() { 499 gfx::ImageSkia ChromeNativeAppWindowViews::GetWindowAppIcon() {
498 gfx::Image app_icon = app_window()->app_icon(); 500 gfx::Image app_icon = extensions_app_window_->app_icon();
499 if (app_icon.IsEmpty()) 501 if (app_icon.IsEmpty())
500 return GetWindowIcon(); 502 return GetWindowIcon();
501 else 503 else
502 return *app_icon.ToImageSkia(); 504 return *app_icon.ToImageSkia();
503 } 505 }
504 506
505 gfx::ImageSkia ChromeNativeAppWindowViews::GetWindowIcon() { 507 gfx::ImageSkia ChromeNativeAppWindowViews::GetWindowIcon() {
506 content::WebContents* web_contents = app_window()->web_contents(); 508 content::WebContents* web_contents = app_window()->GetWebContents();
507 if (web_contents) { 509 if (web_contents) {
508 FaviconTabHelper* favicon_tab_helper = 510 FaviconTabHelper* favicon_tab_helper =
509 FaviconTabHelper::FromWebContents(web_contents); 511 FaviconTabHelper::FromWebContents(web_contents);
510 gfx::Image app_icon = favicon_tab_helper->GetFavicon(); 512 gfx::Image app_icon = favicon_tab_helper->GetFavicon();
511 if (!app_icon.IsEmpty()) 513 if (!app_icon.IsEmpty())
512 return *app_icon.ToImageSkia(); 514 return *app_icon.ToImageSkia();
513 } 515 }
514 return gfx::ImageSkia(); 516 return gfx::ImageSkia();
515 } 517 }
516 518
517 views::NonClientFrameView* ChromeNativeAppWindowViews::CreateNonClientFrameView( 519 views::NonClientFrameView* ChromeNativeAppWindowViews::CreateNonClientFrameView(
518 views::Widget* widget) { 520 views::Widget* widget) {
519 #if defined(USE_ASH) 521 #if defined(USE_ASH)
520 if (chrome::IsNativeViewInAsh(widget->GetNativeView())) { 522 if (chrome::IsNativeViewInAsh(widget->GetNativeView())) {
521 // Set the delegate now because CustomFrameViewAsh sets the 523 // Set the delegate now because CustomFrameViewAsh sets the
522 // WindowStateDelegate if one is not already set. 524 // WindowStateDelegate if one is not already set.
523 ash::wm::GetWindowState(GetNativeWindow())->SetDelegate( 525 ash::wm::GetWindowState(GetNativeWindow())
524 scoped_ptr<ash::wm::WindowStateDelegate>( 526 ->SetDelegate(scoped_ptr<ash::wm::WindowStateDelegate>(
525 new NativeAppWindowStateDelegate(app_window(), this)).Pass()); 527 new NativeAppWindowStateDelegate(
528 extensions_app_window_, this)).Pass());
526 529
527 if (app_window()->window_type_is_panel()) { 530 if (app_window()->WindowTypeIsPanel()) {
528 ash::PanelFrameView::FrameType frame_type = IsFrameless() ? 531 ash::PanelFrameView::FrameType frame_type = IsFrameless() ?
529 ash::PanelFrameView::FRAME_NONE : ash::PanelFrameView::FRAME_ASH; 532 ash::PanelFrameView::FRAME_NONE : ash::PanelFrameView::FRAME_ASH;
530 views::NonClientFrameView* frame_view = 533 views::NonClientFrameView* frame_view =
531 new ash::PanelFrameView(widget, frame_type); 534 new ash::PanelFrameView(widget, frame_type);
532 frame_view->set_context_menu_controller(this); 535 frame_view->set_context_menu_controller(this);
533 return frame_view; 536 return frame_view;
534 } 537 }
535 538
536 if (IsFrameless()) 539 if (IsFrameless())
537 return CreateNonStandardAppFrame(); 540 return CreateNonStandardAppFrame();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 default: 597 default:
595 NOTREACHED() << "Unknown accelerator sent to app window."; 598 NOTREACHED() << "Unknown accelerator sent to app window.";
596 } 599 }
597 return NativeAppWindowViews::AcceleratorPressed(accelerator); 600 return NativeAppWindowViews::AcceleratorPressed(accelerator);
598 } 601 }
599 602
600 // NativeAppWindow implementation. 603 // NativeAppWindow implementation.
601 604
602 void ChromeNativeAppWindowViews::SetFullscreen(int fullscreen_types) { 605 void ChromeNativeAppWindowViews::SetFullscreen(int fullscreen_types) {
603 // Fullscreen not supported by panels. 606 // Fullscreen not supported by panels.
604 if (app_window()->window_type_is_panel()) 607 if (app_window()->WindowTypeIsPanel())
605 return; 608 return;
606 is_fullscreen_ = (fullscreen_types != AppWindow::FULLSCREEN_TYPE_NONE); 609 is_fullscreen_ =
610 (fullscreen_types != native_app_window::FULLSCREEN_TYPE_NONE);
607 widget()->SetFullscreen(is_fullscreen_); 611 widget()->SetFullscreen(is_fullscreen_);
608 612
609 // TODO(oshima): Remove USE_ATHENA once athena has its own NativeAppWindow. 613 // TODO(oshima): Remove USE_ATHENA once athena has its own NativeAppWindow.
610 #if defined(USE_ASH) && !defined(USE_ATHENA) 614 #if defined(USE_ASH) && !defined(USE_ATHENA)
611 if (immersive_fullscreen_controller_.get()) { 615 if (immersive_fullscreen_controller_.get()) {
612 // |immersive_fullscreen_controller_| should only be set if immersive 616 // |immersive_fullscreen_controller_| should only be set if immersive
613 // fullscreen is the fullscreen type used by the OS. 617 // fullscreen is the fullscreen type used by the OS.
614 immersive_fullscreen_controller_->SetEnabled( 618 immersive_fullscreen_controller_->SetEnabled(
615 ash::ImmersiveFullscreenController::WINDOW_TYPE_PACKAGED_APP, 619 ash::ImmersiveFullscreenController::WINDOW_TYPE_PACKAGED_APP,
616 (fullscreen_types & AppWindow::FULLSCREEN_TYPE_OS) != 0); 620 (fullscreen_types & native_app_window::FULLSCREEN_TYPE_OS) != 0);
617 // Autohide the shelf instead of hiding the shelf completely when only in 621 // Autohide the shelf instead of hiding the shelf completely when only in
618 // OS fullscreen. 622 // OS fullscreen.
619 ash::wm::WindowState* window_state = 623 ash::wm::WindowState* window_state =
620 ash::wm::GetWindowState(widget()->GetNativeWindow()); 624 ash::wm::GetWindowState(widget()->GetNativeWindow());
621 window_state->set_hide_shelf_when_fullscreen(fullscreen_types != 625 window_state->set_hide_shelf_when_fullscreen(
622 AppWindow::FULLSCREEN_TYPE_OS); 626 fullscreen_types != native_app_window::FULLSCREEN_TYPE_OS);
623 DCHECK(ash::Shell::HasInstance()); 627 DCHECK(ash::Shell::HasInstance());
624 ash::Shell::GetInstance()->UpdateShelfVisibility(); 628 ash::Shell::GetInstance()->UpdateShelfVisibility();
625 } 629 }
626 #endif 630 #endif
627 631
628 // TODO(jeremya) we need to call RenderViewHost::ExitFullscreen() if we 632 // TODO(jeremya) we need to call RenderViewHost::ExitFullscreen() if we
629 // ever drop the window out of fullscreen in response to something that 633 // ever drop the window out of fullscreen in response to something that
630 // wasn't the app calling webkitCancelFullScreen(). 634 // wasn't the app calling webkitCancelFullScreen().
631 } 635 }
632 636
633 bool ChromeNativeAppWindowViews::IsFullscreenOrPending() const { 637 bool ChromeNativeAppWindowViews::IsFullscreenOrPending() const {
634 return is_fullscreen_; 638 return is_fullscreen_;
635 } 639 }
636 640
637 void ChromeNativeAppWindowViews::UpdateBadgeIcon() { 641 void ChromeNativeAppWindowViews::UpdateBadgeIcon() {
638 const gfx::Image* icon = NULL; 642 const gfx::Image* icon = NULL;
639 if (!app_window()->badge_icon().IsEmpty()) { 643 if (!extensions_app_window_->badge_icon().IsEmpty()) {
640 icon = &app_window()->badge_icon(); 644 icon = &extensions_app_window_->badge_icon();
641 // chrome::DrawTaskbarDecoration can do interesting things with non-square 645 // chrome::DrawTaskbarDecoration can do interesting things with non-square
642 // bitmaps. 646 // bitmaps.
643 // TODO(benwells): Refactor chrome::DrawTaskbarDecoration to not be avatar 647 // TODO(benwells): Refactor chrome::DrawTaskbarDecoration to not be avatar
644 // specific, and lift this restriction. 648 // specific, and lift this restriction.
645 if (icon->Width() != icon->Height()) { 649 if (icon->Width() != icon->Height()) {
646 LOG(ERROR) << "Attempt to set a non-square badge; request ignored."; 650 LOG(ERROR) << "Attempt to set a non-square badge; request ignored.";
647 return; 651 return;
648 } 652 }
649 } 653 }
650 chrome::DrawTaskbarDecoration(GetNativeWindow(), icon); 654 chrome::DrawTaskbarDecoration(GetNativeWindow(), icon);
(...skipping 26 matching lines...) Expand all
677 return active_frame_color_; 681 return active_frame_color_;
678 } 682 }
679 683
680 SkColor ChromeNativeAppWindowViews::InactiveFrameColor() const { 684 SkColor ChromeNativeAppWindowViews::InactiveFrameColor() const {
681 return inactive_frame_color_; 685 return inactive_frame_color_;
682 } 686 }
683 687
684 // NativeAppWindowViews implementation. 688 // NativeAppWindowViews implementation.
685 689
686 void ChromeNativeAppWindowViews::InitializeWindow( 690 void ChromeNativeAppWindowViews::InitializeWindow(
687 AppWindow* app_window, 691 native_app_window::NativeAppWindowDelegate* app_window,
688 const AppWindow::CreateParams& create_params) { 692 const native_app_window::AppWindowCreateParams& create_params) {
689 DCHECK(widget()); 693 DCHECK(widget());
690 has_frame_color_ = create_params.has_frame_color; 694 has_frame_color_ = create_params.has_frame_color;
691 active_frame_color_ = create_params.active_frame_color; 695 active_frame_color_ = create_params.active_frame_color;
692 inactive_frame_color_ = create_params.inactive_frame_color; 696 inactive_frame_color_ = create_params.inactive_frame_color;
693 if (create_params.window_type == AppWindow::WINDOW_TYPE_PANEL || 697 if (create_params.window_type == native_app_window::WINDOW_TYPE_PANEL ||
694 create_params.window_type == AppWindow::WINDOW_TYPE_V1_PANEL) { 698 create_params.window_type == native_app_window::WINDOW_TYPE_V1_PANEL) {
695 InitializePanelWindow(create_params); 699 InitializePanelWindow(create_params);
696 } else { 700 } else {
697 InitializeDefaultWindow(create_params); 701 InitializeDefaultWindow(create_params);
698 } 702 }
699 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( 703 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews(
700 Profile::FromBrowserContext(app_window->browser_context()), 704 Profile::FromBrowserContext(app_window->GetBrowserContext()),
701 widget()->GetFocusManager(), 705 widget()->GetFocusManager(),
702 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, 706 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
703 NULL)); 707 NULL));
704 } 708 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698