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

Side by Side Diff: chrome/browser/ui/panels/panel.cc

Issue 10829186: Tabs API is usable without tabs permission. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 4 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 (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"
(...skipping 19 matching lines...) Expand all
30 #include "content/public/browser/notification_types.h" 30 #include "content/public/browser/notification_types.h"
31 #include "content/public/browser/render_view_host.h" 31 #include "content/public/browser/render_view_host.h"
32 #include "content/public/browser/user_metrics.h" 32 #include "content/public/browser/user_metrics.h"
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "ui/gfx/image/image.h" 34 #include "ui/gfx/image/image.h"
35 #include "ui/gfx/rect.h" 35 #include "ui/gfx/rect.h"
36 36
37 using content::RenderViewHost; 37 using content::RenderViewHost;
38 using content::UserMetricsAction; 38 using content::UserMetricsAction;
39 39
40 namespace extensions {
41 class Extension;
42 }
43
40 namespace panel_internal { 44 namespace panel_internal {
41 45
42 class PanelExtensionWindowController : public extensions::WindowController { 46 class PanelExtensionWindowController : public extensions::WindowController {
43 public: 47 public:
44 PanelExtensionWindowController(Panel* panel, Profile* profile); 48 PanelExtensionWindowController(Panel* panel, Profile* profile);
45 virtual ~PanelExtensionWindowController(); 49 virtual ~PanelExtensionWindowController();
46 50
47 // Overridden from extensions::WindowController. 51 // Overridden from extensions::WindowController.
48 virtual int GetWindowId() const OVERRIDE; 52 virtual int GetWindowId() const OVERRIDE;
49 virtual std::string GetWindowTypeText() const OVERRIDE; 53 virtual std::string GetWindowTypeText() const OVERRIDE;
50 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; 54 virtual base::DictionaryValue* CreateWindowValueWithTabs(
55 const extensions::Extension* extension) const OVERRIDE;
51 virtual bool CanClose(Reason* reason) const OVERRIDE; 56 virtual bool CanClose(Reason* reason) const OVERRIDE;
52 virtual void SetFullscreenMode(bool is_fullscreen, 57 virtual void SetFullscreenMode(bool is_fullscreen,
53 const GURL& extension_url) const OVERRIDE; 58 const GURL& extension_url) const OVERRIDE;
54 virtual bool IsVisibleToExtension( 59 virtual bool IsVisibleToExtension(
55 const extensions::Extension* extension) const OVERRIDE; 60 const extensions::Extension* extension) const OVERRIDE;
56 61
57 private: 62 private:
58 Panel* panel_; // Weak pointer. Owns us. 63 Panel* panel_; // Weak pointer. Owns us.
59 DISALLOW_COPY_AND_ASSIGN(PanelExtensionWindowController); 64 DISALLOW_COPY_AND_ASSIGN(PanelExtensionWindowController);
60 }; 65 };
(...skipping 11 matching lines...) Expand all
72 77
73 int PanelExtensionWindowController::GetWindowId() const { 78 int PanelExtensionWindowController::GetWindowId() const {
74 return static_cast<int>(panel_->session_id().id()); 79 return static_cast<int>(panel_->session_id().id());
75 } 80 }
76 81
77 std::string PanelExtensionWindowController::GetWindowTypeText() const { 82 std::string PanelExtensionWindowController::GetWindowTypeText() const {
78 return extensions::tabs_constants::kWindowTypeValuePanel; 83 return extensions::tabs_constants::kWindowTypeValuePanel;
79 } 84 }
80 85
81 base::DictionaryValue* 86 base::DictionaryValue*
82 PanelExtensionWindowController::CreateWindowValueWithTabs() const { 87 PanelExtensionWindowController::CreateWindowValueWithTabs(
88 const extensions::Extension* extension) const {
83 return CreateWindowValue(); 89 return CreateWindowValue();
84 } 90 }
85 91
86 bool PanelExtensionWindowController::CanClose(Reason* reason) const { 92 bool PanelExtensionWindowController::CanClose(Reason* reason) const {
87 return true; 93 return true;
88 } 94 }
89 95
90 void PanelExtensionWindowController::SetFullscreenMode( 96 void PanelExtensionWindowController::SetFullscreenMode(
91 bool is_fullscreen, const GURL& extension_url) const { 97 bool is_fullscreen, const GURL& extension_url) const {
92 // Do nothing. Panels cannot be fullscreen. 98 // Do nothing. Panels cannot be fullscreen.
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 774
769 void Panel::LoadingStateChanged(bool is_loading) { 775 void Panel::LoadingStateChanged(bool is_loading) {
770 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); 776 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading);
771 native_panel_->UpdatePanelLoadingAnimations(is_loading); 777 native_panel_->UpdatePanelLoadingAnimations(is_loading);
772 UpdateTitleBar(); 778 UpdateTitleBar();
773 } 779 }
774 780
775 void Panel::WebContentsFocused(content::WebContents* contents) { 781 void Panel::WebContentsFocused(content::WebContents* contents) {
776 native_panel_->PanelWebContentsFocused(contents); 782 native_panel_->PanelWebContentsFocused(contents);
777 } 783 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698