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

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

Issue 15021020: content: Extract url utility functions into url_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix content_unittests and content_browsertests Created 7 years, 7 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/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/bookmarks/bookmark_model.h" 11 #include "chrome/browser/bookmarks/bookmark_model.h"
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
13 #include "chrome/browser/bookmarks/bookmark_utils.h" 13 #include "chrome/browser/bookmarks/bookmark_utils.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/browsing_data/browsing_data_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_helper.h"
16 #include "chrome/browser/browsing_data/browsing_data_remover.h" 16 #include "chrome/browser/browsing_data/browsing_data_remover.h"
17 #include "chrome/browser/chrome_page_zoom.h" 17 #include "chrome/browser/chrome_page_zoom.h"
18 #include "chrome/browser/devtools/devtools_window.h" 18 #include "chrome/browser/devtools/devtools_window.h"
19 #include "chrome/browser/download/download_util.h"
20 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/tab_helper.h" 20 #include "chrome/browser/extensions/tab_helper.h"
22 #include "chrome/browser/favicon/favicon_tab_helper.h" 21 #include "chrome/browser/favicon/favicon_tab_helper.h"
23 #include "chrome/browser/google/google_util.h" 22 #include "chrome/browser/google/google_util.h"
24 #include "chrome/browser/lifetime/application_lifetime.h" 23 #include "chrome/browser/lifetime/application_lifetime.h"
25 #include "chrome/browser/managed_mode/managed_user_service.h" 24 #include "chrome/browser/managed_mode/managed_user_service.h"
26 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 25 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
27 #include "chrome/browser/platform_util.h" 26 #include "chrome/browser/platform_util.h"
28 #include "chrome/browser/prefs/incognito_mode_prefs.h" 27 #include "chrome/browser/prefs/incognito_mode_prefs.h"
29 #include "chrome/browser/printing/print_preview_dialog_controller.h" 28 #include "chrome/browser/printing/print_preview_dialog_controller.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "content/public/browser/navigation_entry.h" 63 #include "content/public/browser/navigation_entry.h"
65 #include "content/public/browser/notification_service.h" 64 #include "content/public/browser/notification_service.h"
66 #include "content/public/browser/page_navigator.h" 65 #include "content/public/browser/page_navigator.h"
67 #include "content/public/browser/render_view_host.h" 66 #include "content/public/browser/render_view_host.h"
68 #include "content/public/browser/user_metrics.h" 67 #include "content/public/browser/user_metrics.h"
69 #include "content/public/browser/web_contents.h" 68 #include "content/public/browser/web_contents.h"
70 #include "content/public/browser/web_contents_view.h" 69 #include "content/public/browser/web_contents_view.h"
71 #include "content/public/common/content_restriction.h" 70 #include "content/public/common/content_restriction.h"
72 #include "content/public/common/renderer_preferences.h" 71 #include "content/public/common/renderer_preferences.h"
73 #include "content/public/common/url_constants.h" 72 #include "content/public/common/url_constants.h"
73 #include "content/public/common/url_utils.h"
74 #include "net/base/escape.h" 74 #include "net/base/escape.h"
75 #include "webkit/glue/glue_serialize.h" 75 #include "webkit/glue/glue_serialize.h"
76 #include "webkit/user_agent/user_agent_util.h" 76 #include "webkit/user_agent/user_agent_util.h"
77 77
78 #if defined(OS_MACOSX) 78 #if defined(OS_MACOSX)
79 #include "ui/base/cocoa/find_pasteboard.h" 79 #include "ui/base/cocoa/find_pasteboard.h"
80 #endif 80 #endif
81 81
82 #if defined(OS_WIN) 82 #if defined(OS_WIN)
83 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" 83 #include "chrome/browser/ui/metro_pin_tab_helper_win.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 240
241 int GetContentRestrictions(const Browser* browser) { 241 int GetContentRestrictions(const Browser* browser) {
242 int content_restrictions = 0; 242 int content_restrictions = 0;
243 WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents(); 243 WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents();
244 if (current_tab) { 244 if (current_tab) {
245 content_restrictions = current_tab->GetContentRestrictions(); 245 content_restrictions = current_tab->GetContentRestrictions();
246 NavigationEntry* active_entry = 246 NavigationEntry* active_entry =
247 current_tab->GetController().GetActiveEntry(); 247 current_tab->GetController().GetActiveEntry();
248 // See comment in UpdateCommandsForTabState about why we call url(). 248 // See comment in UpdateCommandsForTabState about why we call url().
249 if (!download_util::IsSavableURL( 249 if (!content::IsSavableURL(
250 active_entry ? active_entry->GetURL() : GURL()) || 250 active_entry ? active_entry->GetURL() : GURL()) ||
251 current_tab->ShowingInterstitialPage()) 251 current_tab->ShowingInterstitialPage())
252 content_restrictions |= content::CONTENT_RESTRICTION_SAVE; 252 content_restrictions |= content::CONTENT_RESTRICTION_SAVE;
253 if (current_tab->ShowingInterstitialPage()) 253 if (current_tab->ShowingInterstitialPage())
254 content_restrictions |= content::CONTENT_RESTRICTION_PRINT; 254 content_restrictions |= content::CONTENT_RESTRICTION_PRINT;
255 } 255 }
256 return content_restrictions; 256 return content_restrictions;
257 } 257 }
258 258
259 void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type) { 259 void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type) {
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), 1094 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(),
1095 browser->host_desktop_type())); 1095 browser->host_desktop_type()));
1096 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1096 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1097 1097
1098 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1098 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1099 contents->GetRenderViewHost()->SyncRendererPrefs(); 1099 contents->GetRenderViewHost()->SyncRendererPrefs();
1100 app_browser->window()->Show(); 1100 app_browser->window()->Show();
1101 } 1101 }
1102 1102
1103 } // namespace chrome 1103 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.cc ('k') | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698