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

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

Issue 7835004: Moved the following IPCs out of chrome into content where they are handled by (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/browser/infobars/infobar_tab_helper.h" 54 #include "chrome/browser/infobars/infobar_tab_helper.h"
55 #include "chrome/browser/instant/instant_controller.h" 55 #include "chrome/browser/instant/instant_controller.h"
56 #include "chrome/browser/instant/instant_unload_handler.h" 56 #include "chrome/browser/instant/instant_unload_handler.h"
57 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" 57 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
58 #include "chrome/browser/net/browser_url_util.h" 58 #include "chrome/browser/net/browser_url_util.h"
59 #include "chrome/browser/net/url_fixer_upper.h" 59 #include "chrome/browser/net/url_fixer_upper.h"
60 #include "chrome/browser/notifications/notification_ui_manager.h" 60 #include "chrome/browser/notifications/notification_ui_manager.h"
61 #include "chrome/browser/platform_util.h" 61 #include "chrome/browser/platform_util.h"
62 #include "chrome/browser/prefs/incognito_mode_prefs.h" 62 #include "chrome/browser/prefs/incognito_mode_prefs.h"
63 #include "chrome/browser/prefs/pref_service.h" 63 #include "chrome/browser/prefs/pref_service.h"
64 #include "chrome/browser/prerender/prerender_tab_helper.h"
64 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" 65 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
65 #include "chrome/browser/printing/print_preview_tab_controller.h" 66 #include "chrome/browser/printing/print_preview_tab_controller.h"
66 #include "chrome/browser/printing/print_view_manager.h" 67 #include "chrome/browser/printing/print_view_manager.h"
67 #include "chrome/browser/profiles/profile.h" 68 #include "chrome/browser/profiles/profile.h"
68 #include "chrome/browser/sessions/restore_tab_helper.h" 69 #include "chrome/browser/sessions/restore_tab_helper.h"
69 #include "chrome/browser/sessions/session_service.h" 70 #include "chrome/browser/sessions/session_service.h"
70 #include "chrome/browser/sessions/session_service_factory.h" 71 #include "chrome/browser/sessions/session_service_factory.h"
71 #include "chrome/browser/sessions/session_types.h" 72 #include "chrome/browser/sessions/session_types.h"
72 #include "chrome/browser/sessions/tab_restore_service.h" 73 #include "chrome/browser/sessions/tab_restore_service.h"
73 #include "chrome/browser/sessions/tab_restore_service_factory.h" 74 #include "chrome/browser/sessions/tab_restore_service_factory.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 #include "content/browser/user_metrics.h" 135 #include "content/browser/user_metrics.h"
135 #include "content/common/content_restriction.h" 136 #include "content/common/content_restriction.h"
136 #include "content/common/content_switches.h" 137 #include "content/common/content_switches.h"
137 #include "content/common/notification_service.h" 138 #include "content/common/notification_service.h"
138 #include "content/common/page_transition_types.h" 139 #include "content/common/page_transition_types.h"
139 #include "content/common/page_zoom.h" 140 #include "content/common/page_zoom.h"
140 #include "content/common/view_messages.h" 141 #include "content/common/view_messages.h"
141 #include "grit/chromium_strings.h" 142 #include "grit/chromium_strings.h"
142 #include "grit/generated_resources.h" 143 #include "grit/generated_resources.h"
143 #include "grit/locale_settings.h" 144 #include "grit/locale_settings.h"
145 #include "grit/theme_resources_standard.h"
144 #include "net/base/cookie_monster.h" 146 #include "net/base/cookie_monster.h"
145 #include "net/base/net_util.h" 147 #include "net/base/net_util.h"
146 #include "net/base/registry_controlled_domain.h" 148 #include "net/base/registry_controlled_domain.h"
147 #include "net/url_request/url_request_context.h" 149 #include "net/url_request/url_request_context.h"
148 #include "ui/base/animation/animation.h" 150 #include "ui/base/animation/animation.h"
149 #include "ui/base/l10n/l10n_util.h" 151 #include "ui/base/l10n/l10n_util.h"
150 #include "ui/gfx/point.h" 152 #include "ui/gfx/point.h"
151 #include "webkit/glue/webkit_glue.h" 153 #include "webkit/glue/webkit_glue.h"
152 #include "webkit/glue/window_open_disposition.h" 154 #include "webkit/glue/window_open_disposition.h"
153 155
(...skipping 15 matching lines...) Expand all
169 #include "chrome/browser/chromeos/boot_times_loader.h" 171 #include "chrome/browser/chromeos/boot_times_loader.h"
170 #include "chrome/browser/ui/webui/active_downloads_ui.h" 172 #include "chrome/browser/ui/webui/active_downloads_ui.h"
171 #else 173 #else
172 #include "chrome/browser/download/download_shelf.h" 174 #include "chrome/browser/download/download_shelf.h"
173 #endif 175 #endif
174 176
175 #if defined(FILE_MANAGER_EXTENSION) 177 #if defined(FILE_MANAGER_EXTENSION)
176 #include "chrome/browser/extensions/file_manager_util.h" 178 #include "chrome/browser/extensions/file_manager_util.h"
177 #endif 179 #endif
178 180
181 #include "webkit/plugins/npapi/plugin_list.h"
182
179 using base::TimeDelta; 183 using base::TimeDelta;
180 184
181 /////////////////////////////////////////////////////////////////////////////// 185 ///////////////////////////////////////////////////////////////////////////////
182 186
183 namespace { 187 namespace {
184 188
185 // The URL to be loaded to display Help. 189 // The URL to be loaded to display Help.
186 const char kHelpContentUrl[] = 190 const char kHelpContentUrl[] =
187 #if defined(OS_CHROMEOS) 191 #if defined(OS_CHROMEOS)
188 #if defined(OFFICIAL_BUILD) 192 #if defined(OFFICIAL_BUILD)
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( 2545 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
2542 tab); 2546 tab);
2543 if (!tcw || !tcw->find_tab_helper()) 2547 if (!tcw || !tcw->find_tab_helper())
2544 return; 2548 return;
2545 2549
2546 tcw->find_tab_helper()->HandleFindReply(request_id, number_of_matches, 2550 tcw->find_tab_helper()->HandleFindReply(request_id, number_of_matches,
2547 selection_rect, active_match_ordinal, 2551 selection_rect, active_match_ordinal,
2548 final_update); 2552 final_update);
2549 } 2553 }
2550 2554
2555 // static
2556 void Browser::CrashedPluginHelper(TabContents* tab,
2557 const FilePath& plugin_path) {
2558 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
2559 tab);
2560 if (!tcw)
2561 return;
2562
2563 DCHECK(!plugin_path.value().empty());
2564
2565 string16 plugin_name = plugin_path.LossyDisplayName();
2566 webkit::WebPluginInfo plugin_info;
2567 if (webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath(
2568 plugin_path, &plugin_info) &&
2569 !plugin_info.name.empty()) {
2570 plugin_name = plugin_info.name;
2571 #if defined(OS_MACOSX)
2572 // Many plugins on the Mac have .plugin in the actual name, which looks
2573 // terrible, so look for that and strip it off if present.
2574 const std::string kPluginExtension = ".plugin";
2575 if (EndsWith(plugin_name, ASCIIToUTF16(kPluginExtension), true))
2576 plugin_name.erase(plugin_name.length() - kPluginExtension.length());
2577 #endif // OS_MACOSX
2578 }
2579 gfx::Image* icon = &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
2580 IDR_INFOBAR_PLUGIN_CRASHED);
2581 tcw->infobar_tab_helper()->AddInfoBar(
2582 new SimpleAlertInfoBarDelegate(
2583 tab,
2584 icon,
2585 l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, plugin_name),
2586 true));
2587 }
2588
2589 // static
2590 void Browser::UpdateTargetURLHelper(TabContents* tab, int32 page_id,
2591 const GURL& url) {
2592 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
2593 tab);
2594 if (!tcw || !tcw->prerender_tab_helper())
2595 return;
2596 tcw->prerender_tab_helper()->UpdateTargetURL(page_id, url);
2597 }
2598
2551 void Browser::ExecuteCommandWithDisposition( 2599 void Browser::ExecuteCommandWithDisposition(
2552 int id, WindowOpenDisposition disposition) { 2600 int id, WindowOpenDisposition disposition) {
2553 // No commands are enabled if there is not yet any selected tab. 2601 // No commands are enabled if there is not yet any selected tab.
2554 // TODO(pkasting): It seems like we should not need this, because either 2602 // TODO(pkasting): It seems like we should not need this, because either
2555 // most/all commands should not have been enabled yet anyway or the ones that 2603 // most/all commands should not have been enabled yet anyway or the ones that
2556 // are enabled should be global, or safe themselves against having no selected 2604 // are enabled should be global, or safe themselves against having no selected
2557 // tab. However, Ben says he tried removing this before and got lots of 2605 // tab. However, Ben says he tried removing this before and got lots of
2558 // crashes, e.g. from Windows sending WM_COMMANDs at random times during 2606 // crashes, e.g. from Windows sending WM_COMMANDs at random times during
2559 // window construction. This probably could use closer examination someday. 2607 // window construction. This probably could use closer examination someday.
2560 if (!GetSelectedTabContentsWrapper()) 2608 if (!GetSelectedTabContentsWrapper())
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 if (!GetStatusBubble()) 3529 if (!GetStatusBubble())
3482 return; 3530 return;
3483 3531
3484 if (source == GetSelectedTabContents()) { 3532 if (source == GetSelectedTabContents()) {
3485 GetStatusBubble()->MouseMoved(location, !motion); 3533 GetStatusBubble()->MouseMoved(location, !motion);
3486 if (!motion) 3534 if (!motion)
3487 GetStatusBubble()->SetURL(GURL(), std::string()); 3535 GetStatusBubble()->SetURL(GURL(), std::string());
3488 } 3536 }
3489 } 3537 }
3490 3538
3491 void Browser::UpdateTargetURL(TabContents* source, const GURL& url) { 3539 void Browser::UpdateTargetURL(TabContents* source, int32 page_id,
3540 const GURL& url) {
3541 Browser::UpdateTargetURLHelper(source, page_id, url);
3542
3492 if (!GetStatusBubble()) 3543 if (!GetStatusBubble())
3493 return; 3544 return;
3494 3545
3495 if (source == GetSelectedTabContents()) { 3546 if (source == GetSelectedTabContents()) {
3496 PrefService* prefs = profile_->GetPrefs(); 3547 PrefService* prefs = profile_->GetPrefs();
3497 GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages)); 3548 GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages));
3498 } 3549 }
3499 } 3550 }
3500 3551
3501 void Browser::UpdateDownloadShelfVisibility(bool visible) { 3552 void Browser::UpdateDownloadShelfVisibility(bool visible) {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
3812 void Browser::FindReply(TabContents* tab, 3863 void Browser::FindReply(TabContents* tab,
3813 int request_id, 3864 int request_id,
3814 int number_of_matches, 3865 int number_of_matches,
3815 const gfx::Rect& selection_rect, 3866 const gfx::Rect& selection_rect,
3816 int active_match_ordinal, 3867 int active_match_ordinal,
3817 bool final_update) { 3868 bool final_update) {
3818 FindReplyHelper(tab, request_id, number_of_matches, selection_rect, 3869 FindReplyHelper(tab, request_id, number_of_matches, selection_rect,
3819 active_match_ordinal, final_update); 3870 active_match_ordinal, final_update);
3820 } 3871 }
3821 3872
3873 void Browser::CrashedPlugin(TabContents* tab, const FilePath& plugin_path) {
3874 CrashedPluginHelper(tab, plugin_path);
3875 }
3876
3822 void Browser::ExitTabbedFullscreenModeIfNecessary() { 3877 void Browser::ExitTabbedFullscreenModeIfNecessary() {
3823 if (tab_caused_fullscreen_) 3878 if (tab_caused_fullscreen_)
3824 ToggleFullscreenMode(); 3879 ToggleFullscreenMode();
3825 else 3880 else
3826 NotifyTabOfFullscreenExitIfNecessary(); 3881 NotifyTabOfFullscreenExitIfNecessary();
3827 } 3882 }
3828 3883
3829 /////////////////////////////////////////////////////////////////////////////// 3884 ///////////////////////////////////////////////////////////////////////////////
3830 // Browser, TabContentsWrapperDelegate implementation: 3885 // Browser, TabContentsWrapperDelegate implementation:
3831 3886
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
5188 profile()->GetOriginalProfile()->GetProfileSyncService(); 5243 profile()->GetOriginalProfile()->GetProfileSyncService();
5189 if (service->HasSyncSetupCompleted()) 5244 if (service->HasSyncSetupCompleted())
5190 ShowOptionsTab(chrome::kSyncSetupSubPage); 5245 ShowOptionsTab(chrome::kSyncSetupSubPage);
5191 else 5246 else
5192 service->ShowLoginDialog(); 5247 service->ShowLoginDialog();
5193 } 5248 }
5194 5249
5195 void Browser::ToggleSpeechInput() { 5250 void Browser::ToggleSpeechInput() {
5196 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); 5251 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput();
5197 } 5252 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698