OLD | NEW |
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 "chrome/browser/ui/panels/panel.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 11 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
12 #include "chrome/browser/extensions/extension_window_controller.h" | 12 #include "chrome/browser/extensions/window_controller.h" |
13 #include "chrome/browser/lifetime/application_lifetime.h" | 13 #include "chrome/browser/lifetime/application_lifetime.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/panels/native_panel.h" | 15 #include "chrome/browser/ui/panels/native_panel.h" |
16 #include "chrome/browser/ui/panels/panel_host.h" | 16 #include "chrome/browser/ui/panels/panel_host.h" |
17 #include "chrome/browser/ui/panels/panel_manager.h" | 17 #include "chrome/browser/ui/panels/panel_manager.h" |
18 #include "chrome/browser/ui/panels/panel_strip.h" | 18 #include "chrome/browser/ui/panels/panel_strip.h" |
19 #include "chrome/browser/web_applications/web_app.h" | 19 #include "chrome/browser/web_applications/web_app.h" |
20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
24 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
25 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
26 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
28 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
29 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
30 | 30 |
31 using content::RenderViewHost; | 31 using content::RenderViewHost; |
32 using content::UserMetricsAction; | 32 using content::UserMetricsAction; |
33 | 33 |
34 namespace panel_internal { | 34 namespace panel_internal { |
35 | 35 |
36 class PanelExtensionWindowController : public ExtensionWindowController { | 36 class PanelExtensionWindowController : public extensions::WindowController { |
37 public: | 37 public: |
38 PanelExtensionWindowController(Panel* panel, Profile* profile); | 38 PanelExtensionWindowController(Panel* panel, Profile* profile); |
39 | 39 |
40 // Overridden from ExtensionWindowController. | 40 // Overridden from extensions::WindowController. |
41 virtual int GetWindowId() const OVERRIDE; | 41 virtual int GetWindowId() const OVERRIDE; |
42 virtual std::string GetWindowTypeText() const OVERRIDE; | 42 virtual std::string GetWindowTypeText() const OVERRIDE; |
43 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; | 43 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; |
44 virtual bool CanClose(Reason* reason) const OVERRIDE; | 44 virtual bool CanClose(Reason* reason) const OVERRIDE; |
45 virtual void SetFullscreenMode(bool is_fullscreen, | 45 virtual void SetFullscreenMode(bool is_fullscreen, |
46 const GURL& extension_url) const OVERRIDE; | 46 const GURL& extension_url) const OVERRIDE; |
47 virtual bool IsVisibleToExtension( | 47 virtual bool IsVisibleToExtension( |
48 const extensions::Extension* extension) const OVERRIDE; | 48 const extensions::Extension* extension) const OVERRIDE; |
49 | 49 |
50 private: | 50 private: |
51 Panel* panel_; // Weak pointer. Owns us. | 51 Panel* panel_; // Weak pointer. Owns us. |
52 DISALLOW_COPY_AND_ASSIGN(PanelExtensionWindowController); | 52 DISALLOW_COPY_AND_ASSIGN(PanelExtensionWindowController); |
53 }; | 53 }; |
54 | 54 |
55 PanelExtensionWindowController::PanelExtensionWindowController( | 55 PanelExtensionWindowController::PanelExtensionWindowController( |
56 Panel* panel, Profile* profile) | 56 Panel* panel, Profile* profile) |
57 : ExtensionWindowController(panel, profile), | 57 : extensions::WindowController(panel, profile), |
58 panel_(panel) { | 58 panel_(panel) { |
59 } | 59 } |
60 | 60 |
61 int PanelExtensionWindowController::GetWindowId() const { | 61 int PanelExtensionWindowController::GetWindowId() const { |
62 return static_cast<int>(panel_->session_id().id()); | 62 return static_cast<int>(panel_->session_id().id()); |
63 } | 63 } |
64 | 64 |
65 std::string PanelExtensionWindowController::GetWindowTypeText() const { | 65 std::string PanelExtensionWindowController::GetWindowTypeText() const { |
66 return extensions::tabs_constants::kWindowTypeValuePanel; | 66 return extensions::tabs_constants::kWindowTypeValuePanel; |
67 } | 67 } |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 | 718 |
719 void Panel::UpdateTitleBar() { | 719 void Panel::UpdateTitleBar() { |
720 native_panel_->UpdatePanelTitleBar(); | 720 native_panel_->UpdatePanelTitleBar(); |
721 } | 721 } |
722 | 722 |
723 void Panel::LoadingStateChanged(bool is_loading) { | 723 void Panel::LoadingStateChanged(bool is_loading) { |
724 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); | 724 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); |
725 native_panel_->UpdatePanelLoadingAnimations(is_loading); | 725 native_panel_->UpdatePanelLoadingAnimations(is_loading); |
726 UpdateTitleBar(); | 726 UpdateTitleBar(); |
727 } | 727 } |
OLD | NEW |