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

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

Issue 16374006: Place browser-modal dialogs like web-contents-modal dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert changes to c/b/chromeos files for now. Created 7 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 "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/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/views/constrained_window_views.h"
11 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" 12 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h"
12 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
13 #include "content/public/browser/notification_details.h" 14 #include "content/public/browser/notification_details.h"
14 #include "content/public/browser/notification_source.h" 15 #include "content/public/browser/notification_source.h"
15 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/render_widget_host_view.h" 17 #include "content/public/browser/render_widget_host_view.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/browser/web_contents_view.h" 19 #include "content/public/browser/web_contents_view.h"
19 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
20 #include "ui/base/base_window.h" 21 #include "ui/base/base_window.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DCHECK(manager); 92 DCHECK(manager);
92 if (!manager) 93 if (!manager)
93 return NULL; 94 return NULL;
94 return manager->CreateDialogHost(url); 95 return manager->CreateDialogHost(url);
95 } 96 }
96 97
97 void ExtensionDialog::InitWindow(ui::BaseWindow* base_window, 98 void ExtensionDialog::InitWindow(ui::BaseWindow* base_window,
98 int width, 99 int width,
99 int height) { 100 int height) {
100 gfx::NativeWindow parent = base_window->GetNativeWindow(); 101 gfx::NativeWindow parent = base_window->GetNativeWindow();
101 window_ = views::DialogDelegate::CreateDialogWidget(this, NULL, parent); 102 window_ = CreateBrowserModalDialogViews(this, parent);
102 103
103 // Center the window over the browser. 104 // Center the window over the browser.
104 gfx::Point center = base_window->GetBounds().CenterPoint(); 105 gfx::Point center = base_window->GetBounds().CenterPoint();
105 int x = center.x() - width / 2; 106 int x = center.x() - width / 2;
106 int y = center.y() - height / 2; 107 int y = center.y() - height / 2;
107 // Ensure the top left and top right of the window are on screen, with 108 // Ensure the top left and top right of the window are on screen, with
108 // priority given to the top left. 109 // priority given to the top left.
109 gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)-> 110 gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)->
110 GetDisplayNearestPoint(center).bounds(); 111 GetDisplayNearestPoint(center).bounds();
111 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height); 112 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 if (content::Details<extensions::ExtensionHost>(host()) != details) 227 if (content::Details<extensions::ExtensionHost>(host()) != details)
227 return; 228 return;
228 if (observer_) 229 if (observer_)
229 observer_->ExtensionTerminated(this); 230 observer_->ExtensionTerminated(this);
230 break; 231 break;
231 default: 232 default:
232 NOTREACHED() << L"Received unexpected notification"; 233 NOTREACHED() << L"Received unexpected notification";
233 break; 234 break;
234 } 235 }
235 } 236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698