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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_dialog.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_dialog.h" 5 #include "chrome/browser/ui/views/extensions/extension_dialog.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" 12 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h"
13 #include "chrome/browser/ui/views/window.h" // CreateViewsWindow 13 #include "chrome/browser/ui/views/window.h" // CreateViewsWindow
14 #include "chrome/common/chrome_notification_types.h"
14 #include "content/browser/renderer_host/render_view_host.h" 15 #include "content/browser/renderer_host/render_view_host.h"
15 #include "content/browser/renderer_host/render_widget_host_view.h" 16 #include "content/browser/renderer_host/render_widget_host_view.h"
16 #include "content/common/notification_details.h" 17 #include "content/common/notification_details.h"
17 #include "content/common/notification_source.h" 18 #include "content/common/notification_source.h"
18 #include "content/common/notification_type.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 #include "views/widget/widget.h" 20 #include "views/widget/widget.h"
21 21
22 ExtensionDialog::ExtensionDialog(Browser* browser, ExtensionHost* host, 22 ExtensionDialog::ExtensionDialog(Browser* browser, ExtensionHost* host,
23 int width, int height, 23 int width, int height,
24 ExtensionDialogObserver* observer) 24 ExtensionDialogObserver* observer)
25 : extension_host_(host), 25 : extension_host_(host),
26 observer_(observer) { 26 observer_(observer) {
27 AddRef(); // Balanced in DeleteDelegate(); 27 AddRef(); // Balanced in DeleteDelegate();
28 gfx::NativeWindow parent = browser->window()->GetNativeHandle(); 28 gfx::NativeWindow parent = browser->window()->GetNativeHandle();
29 window_ = browser::CreateViewsWindow( 29 window_ = browser::CreateViewsWindow(
30 parent, gfx::Rect(), this /* views::WidgetDelegate */); 30 parent, gfx::Rect(), this /* views::WidgetDelegate */);
31 31
32 // Center the window over the browser. 32 // Center the window over the browser.
33 gfx::Point center = browser->window()->GetBounds().CenterPoint(); 33 gfx::Point center = browser->window()->GetBounds().CenterPoint();
34 int x = center.x() - width / 2; 34 int x = center.x() - width / 2;
35 int y = center.y() - height / 2; 35 int y = center.y() - height / 2;
36 window_->SetBounds(gfx::Rect(x, y, width, height)); 36 window_->SetBounds(gfx::Rect(x, y, width, height));
37 37
38 host->view()->SetContainer(this /* ExtensionView::Container */); 38 host->view()->SetContainer(this /* ExtensionView::Container */);
39 39
40 // Listen for the containing view calling window.close(); 40 // Listen for the containing view calling window.close();
41 registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, 41 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
42 Source<Profile>(host->profile())); 42 Source<Profile>(host->profile()));
43 43
44 window_->Show(); 44 window_->Show();
45 } 45 }
46 46
47 ExtensionDialog::~ExtensionDialog() { 47 ExtensionDialog::~ExtensionDialog() {
48 } 48 }
49 49
50 // static 50 // static
51 ExtensionDialog* ExtensionDialog::Show( 51 ExtensionDialog* ExtensionDialog::Show(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 void ExtensionDialog::OnExtensionMouseLeave(ExtensionView* view) { 121 void ExtensionDialog::OnExtensionMouseLeave(ExtensionView* view) {
122 } 122 }
123 123
124 void ExtensionDialog::OnExtensionPreferredSizeChanged(ExtensionView* view) { 124 void ExtensionDialog::OnExtensionPreferredSizeChanged(ExtensionView* view) {
125 } 125 }
126 126
127 ///////////////////////////////////////////////////////////////////////////// 127 /////////////////////////////////////////////////////////////////////////////
128 // NotificationObserver overrides. 128 // NotificationObserver overrides.
129 129
130 void ExtensionDialog::Observe(NotificationType type, 130 void ExtensionDialog::Observe(int type,
131 const NotificationSource& source, 131 const NotificationSource& source,
132 const NotificationDetails& details) { 132 const NotificationDetails& details) {
133 switch (type.value) { 133 switch (type) {
134 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: 134 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE:
135 // If we aren't the host of the popup, then disregard the notification. 135 // If we aren't the host of the popup, then disregard the notification.
136 if (Details<ExtensionHost>(host()) != details) 136 if (Details<ExtensionHost>(host()) != details)
137 return; 137 return;
138 Close(); 138 Close();
139 break; 139 break;
140 default: 140 default:
141 NOTREACHED() << L"Received unexpected notification"; 141 NOTREACHED() << L"Received unexpected notification";
142 break; 142 break;
143 } 143 }
144 } 144 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_dialog.h ('k') | chrome/browser/ui/views/extensions/extension_installed_bubble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698