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

Side by Side Diff: chrome/browser/ui/browser_commands.cc

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make PopupManager a thin API for WCMDM Created 6 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" 54 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
55 #include "chrome/browser/upgrade_detector.h" 55 #include "chrome/browser/upgrade_detector.h"
56 #include "chrome/browser/web_applications/web_app.h" 56 #include "chrome/browser/web_applications/web_app.h"
57 #include "chrome/common/chrome_switches.h" 57 #include "chrome/common/chrome_switches.h"
58 #include "chrome/common/chrome_version_info.h" 58 #include "chrome/common/chrome_version_info.h"
59 #include "chrome/common/content_restriction.h" 59 #include "chrome/common/content_restriction.h"
60 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 60 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
61 #include "chrome/common/pref_names.h" 61 #include "chrome/common/pref_names.h"
62 #include "components/bookmarks/browser/bookmark_model.h" 62 #include "components/bookmarks/browser/bookmark_model.h"
63 #include "components/bookmarks/browser/bookmark_utils.h" 63 #include "components/bookmarks/browser/bookmark_utils.h"
64 #include "components/web_modal/web_contents_modal_dialog_manager.h" 64 #include "components/web_modal/popup_manager.h"
65 #include "content/public/browser/devtools_agent_host.h" 65 #include "content/public/browser/devtools_agent_host.h"
66 #include "content/public/browser/navigation_controller.h" 66 #include "content/public/browser/navigation_controller.h"
67 #include "content/public/browser/navigation_entry.h" 67 #include "content/public/browser/navigation_entry.h"
68 #include "content/public/browser/notification_service.h" 68 #include "content/public/browser/notification_service.h"
69 #include "content/public/browser/page_navigator.h" 69 #include "content/public/browser/page_navigator.h"
70 #include "content/public/browser/render_view_host.h" 70 #include "content/public/browser/render_view_host.h"
71 #include "content/public/browser/render_widget_host_view.h" 71 #include "content/public/browser/render_widget_host_view.h"
72 #include "content/public/browser/user_metrics.h" 72 #include "content/public/browser/user_metrics.h"
73 #include "content/public/browser/web_contents.h" 73 #include "content/public/browser/web_contents.h"
74 #include "content/public/common/renderer_preferences.h" 74 #include "content/public/common/renderer_preferences.h"
(...skipping 23 matching lines...) Expand all
98 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; 98 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3";
99 } 99 }
100 100
101 using base::UserMetricsAction; 101 using base::UserMetricsAction;
102 using content::NavigationController; 102 using content::NavigationController;
103 using content::NavigationEntry; 103 using content::NavigationEntry;
104 using content::OpenURLParams; 104 using content::OpenURLParams;
105 using content::Referrer; 105 using content::Referrer;
106 using content::SSLStatus; 106 using content::SSLStatus;
107 using content::WebContents; 107 using content::WebContents;
108 using web_modal::WebContentsModalDialogManager;
109 108
110 namespace chrome { 109 namespace chrome {
111 namespace { 110 namespace {
112 111
113 bool CanBookmarkCurrentPageInternal(const Browser* browser, 112 bool CanBookmarkCurrentPageInternal(const Browser* browser,
114 bool check_remove_bookmark_ui) { 113 bool check_remove_bookmark_ui) {
115 BookmarkModel* model = 114 BookmarkModel* model =
116 BookmarkModelFactory::GetForProfile(browser->profile()); 115 BookmarkModelFactory::GetForProfile(browser->profile());
117 return browser_defaults::bookmarks_enabled && 116 return browser_defaults::bookmarks_enabled &&
118 browser->profile()->GetPrefs()->GetBoolean( 117 browser->profile()->GetPrefs()->GetBoolean(
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 else 236 else
238 new_tab->GetController().Reload(true); 237 new_tab->GetController().Reload(true);
239 } 238 }
240 239
241 bool IsShowingWebContentsModalDialog(const Browser* browser) { 240 bool IsShowingWebContentsModalDialog(const Browser* browser) {
242 WebContents* web_contents = 241 WebContents* web_contents =
243 browser->tab_strip_model()->GetActiveWebContents(); 242 browser->tab_strip_model()->GetActiveWebContents();
244 if (!web_contents) 243 if (!web_contents)
245 return false; 244 return false;
246 245
247 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 246 // TODO(gbillock): This gets called by the CanPrint method, and may be too
248 WebContentsModalDialogManager::FromWebContents(web_contents); 247 // restrictive if we allow print preview to overlap -- we should just queue
249 return web_contents_modal_dialog_manager->IsDialogActive(); 248 // print requests or attach a user gesture or whatever we know.
249 return browser->popup_manager()->IsWebModalDialogActive(web_contents);
250 } 250 }
251 251
252 bool PrintPreviewShowing(const Browser* browser) { 252 bool PrintPreviewShowing(const Browser* browser) {
253 #if defined(ENABLE_FULL_PRINTING) 253 #if defined(ENABLE_FULL_PRINTING)
254 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); 254 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
255 printing::PrintPreviewDialogController* controller = 255 printing::PrintPreviewDialogController* controller =
256 printing::PrintPreviewDialogController::GetInstance(); 256 printing::PrintPreviewDialogController::GetInstance();
257 return controller && (controller->GetPrintPreviewForContents(contents) || 257 return controller && (controller->GetPrintPreviewForContents(contents) ||
258 controller->is_creating_print_preview_dialog()); 258 controller->is_creating_print_preview_dialog());
259 #else 259 #else
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 browser->profile(), 1257 browser->profile(),
1258 browser->host_desktop_type())); 1258 browser->host_desktop_type()));
1259 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1259 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1260 1260
1261 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1261 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1262 contents->GetRenderViewHost()->SyncRendererPrefs(); 1262 contents->GetRenderViewHost()->SyncRendererPrefs();
1263 app_browser->window()->Show(); 1263 app_browser->window()->Show();
1264 } 1264 }
1265 1265
1266 } // namespace chrome 1266 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698