| OLD | NEW |
| 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/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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #include "chrome/common/extensions/extension.h" | 141 #include "chrome/common/extensions/extension.h" |
| 142 #include "chrome/common/extensions/extension_constants.h" | 142 #include "chrome/common/extensions/extension_constants.h" |
| 143 #include "chrome/common/pref_names.h" | 143 #include "chrome/common/pref_names.h" |
| 144 #include "chrome/common/profiling.h" | 144 #include "chrome/common/profiling.h" |
| 145 #include "chrome/common/url_constants.h" | 145 #include "chrome/common/url_constants.h" |
| 146 #include "chrome/common/web_apps.h" | 146 #include "chrome/common/web_apps.h" |
| 147 #include "content/browser/browser_url_handler.h" | 147 #include "content/browser/browser_url_handler.h" |
| 148 #include "content/browser/child_process_security_policy.h" | 148 #include "content/browser/child_process_security_policy.h" |
| 149 #include "content/browser/host_zoom_map.h" | 149 #include "content/browser/host_zoom_map.h" |
| 150 #include "content/browser/renderer_host/render_view_host.h" | 150 #include "content/browser/renderer_host/render_view_host.h" |
| 151 #include "content/browser/site_instance.h" | |
| 152 #include "content/browser/tab_contents/interstitial_page.h" | 151 #include "content/browser/tab_contents/interstitial_page.h" |
| 153 #include "content/public/browser/devtools_manager.h" | 152 #include "content/public/browser/devtools_manager.h" |
| 154 #include "content/public/browser/download_item.h" | 153 #include "content/public/browser/download_item.h" |
| 155 #include "content/public/browser/download_manager.h" | 154 #include "content/public/browser/download_manager.h" |
| 156 #include "content/public/browser/invalidate_type.h" | 155 #include "content/public/browser/invalidate_type.h" |
| 157 #include "content/public/browser/navigation_controller.h" | 156 #include "content/public/browser/navigation_controller.h" |
| 158 #include "content/public/browser/navigation_entry.h" | 157 #include "content/public/browser/navigation_entry.h" |
| 159 #include "content/public/browser/notification_details.h" | 158 #include "content/public/browser/notification_details.h" |
| 160 #include "content/public/browser/notification_service.h" | 159 #include "content/public/browser/notification_service.h" |
| 161 #include "content/public/browser/plugin_service.h" | 160 #include "content/public/browser/plugin_service.h" |
| 161 #include "content/public/browser/site_instance.h" |
| 162 #include "content/public/browser/user_metrics.h" | 162 #include "content/public/browser/user_metrics.h" |
| 163 #include "content/public/browser/web_contents.h" | 163 #include "content/public/browser/web_contents.h" |
| 164 #include "content/public/browser/web_contents_view.h" | 164 #include "content/public/browser/web_contents_view.h" |
| 165 #include "content/public/browser/web_intents_dispatcher.h" | 165 #include "content/public/browser/web_intents_dispatcher.h" |
| 166 #include "content/public/common/content_restriction.h" | 166 #include "content/public/common/content_restriction.h" |
| 167 #include "content/public/common/content_switches.h" | 167 #include "content/public/common/content_switches.h" |
| 168 #include "content/public/common/page_zoom.h" | 168 #include "content/public/common/page_zoom.h" |
| 169 #include "grit/chromium_strings.h" | 169 #include "grit/chromium_strings.h" |
| 170 #include "grit/generated_resources.h" | 170 #include "grit/generated_resources.h" |
| 171 #include "grit/locale_settings.h" | 171 #include "grit/locale_settings.h" |
| (...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 | 2138 |
| 2139 void Browser::OpenBookmarkManagerForNode(int64 node_id) { | 2139 void Browser::OpenBookmarkManagerForNode(int64 node_id) { |
| 2140 OpenBookmarkManagerWithHash("", node_id); | 2140 OpenBookmarkManagerWithHash("", node_id); |
| 2141 } | 2141 } |
| 2142 | 2142 |
| 2143 void Browser::OpenBookmarkManagerEditNode(int64 node_id) { | 2143 void Browser::OpenBookmarkManagerEditNode(int64 node_id) { |
| 2144 OpenBookmarkManagerWithHash("e=", node_id); | 2144 OpenBookmarkManagerWithHash("e=", node_id); |
| 2145 } | 2145 } |
| 2146 | 2146 |
| 2147 bool Browser::MaybeCreateBackgroundContents(int route_id, | 2147 bool Browser::MaybeCreateBackgroundContents(int route_id, |
| 2148 SiteInstance* site, | 2148 content::SiteInstance* site, |
| 2149 const GURL& opener_url, | 2149 const GURL& opener_url, |
| 2150 const string16& frame_name) { | 2150 const string16& frame_name) { |
| 2151 ExtensionService* extensions_service = profile_->GetExtensionService(); | 2151 ExtensionService* extensions_service = profile_->GetExtensionService(); |
| 2152 | 2152 |
| 2153 if (!opener_url.is_valid() || | 2153 if (!opener_url.is_valid() || |
| 2154 frame_name.empty() || | 2154 frame_name.empty() || |
| 2155 !extensions_service || | 2155 !extensions_service || |
| 2156 !extensions_service->is_ready()) | 2156 !extensions_service->is_ready()) |
| 2157 return false; | 2157 return false; |
| 2158 | 2158 |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3158 } | 3158 } |
| 3159 | 3159 |
| 3160 int Browser::GetDragActions() const { | 3160 int Browser::GetDragActions() const { |
| 3161 return TabStripModelDelegate::TAB_TEAROFF_ACTION | (tab_count() > 1 ? | 3161 return TabStripModelDelegate::TAB_TEAROFF_ACTION | (tab_count() > 1 ? |
| 3162 TabStripModelDelegate::TAB_MOVE_ACTION : 0); | 3162 TabStripModelDelegate::TAB_MOVE_ACTION : 0); |
| 3163 } | 3163 } |
| 3164 | 3164 |
| 3165 TabContentsWrapper* Browser::CreateTabContentsForURL( | 3165 TabContentsWrapper* Browser::CreateTabContentsForURL( |
| 3166 const GURL& url, const content::Referrer& referrer, Profile* profile, | 3166 const GURL& url, const content::Referrer& referrer, Profile* profile, |
| 3167 content::PageTransition transition, bool defer_load, | 3167 content::PageTransition transition, bool defer_load, |
| 3168 SiteInstance* instance) const { | 3168 content::SiteInstance* instance) const { |
| 3169 TabContentsWrapper* contents = TabContentsFactory(profile, instance, | 3169 TabContentsWrapper* contents = TabContentsFactory(profile, instance, |
| 3170 MSG_ROUTING_NONE, | 3170 MSG_ROUTING_NONE, |
| 3171 GetSelectedWebContents(), NULL); | 3171 GetSelectedWebContents(), NULL); |
| 3172 if (!defer_load) { | 3172 if (!defer_load) { |
| 3173 // Load the initial URL before adding the new tab contents to the tab strip | 3173 // Load the initial URL before adding the new tab contents to the tab strip |
| 3174 // so that the tab contents has navigation state. | 3174 // so that the tab contents has navigation state. |
| 3175 contents->web_contents()->GetController().LoadURL( | 3175 contents->web_contents()->GetController().LoadURL( |
| 3176 url, referrer, transition, std::string()); | 3176 url, referrer, transition, std::string()); |
| 3177 } | 3177 } |
| 3178 | 3178 |
| (...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5268 | 5268 |
| 5269 DCHECK_EQ(tab_restore_service_, service); | 5269 DCHECK_EQ(tab_restore_service_, service); |
| 5270 tab_restore_service_->RemoveObserver(this); | 5270 tab_restore_service_->RemoveObserver(this); |
| 5271 tab_restore_service_ = NULL; | 5271 tab_restore_service_ = NULL; |
| 5272 } | 5272 } |
| 5273 | 5273 |
| 5274 // Centralized method for creating a TabContents, configuring and installing | 5274 // Centralized method for creating a TabContents, configuring and installing |
| 5275 // all its supporting objects and observers. | 5275 // all its supporting objects and observers. |
| 5276 TabContentsWrapper* Browser::TabContentsFactory( | 5276 TabContentsWrapper* Browser::TabContentsFactory( |
| 5277 Profile* profile, | 5277 Profile* profile, |
| 5278 SiteInstance* site_instance, | 5278 content::SiteInstance* site_instance, |
| 5279 int routing_id, | 5279 int routing_id, |
| 5280 const WebContents* base_web_contents, | 5280 const WebContents* base_web_contents, |
| 5281 SessionStorageNamespace* session_storage_namespace) { | 5281 SessionStorageNamespace* session_storage_namespace) { |
| 5282 WebContents* new_contents = WebContents::Create( | 5282 WebContents* new_contents = WebContents::Create( |
| 5283 profile, site_instance, routing_id, base_web_contents, | 5283 profile, site_instance, routing_id, base_web_contents, |
| 5284 session_storage_namespace); | 5284 session_storage_namespace); |
| 5285 TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); | 5285 TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); |
| 5286 return wrapper; | 5286 return wrapper; |
| 5287 } | 5287 } |
| 5288 | 5288 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5494 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 5494 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
| 5495 window_->GetLocationBar()->ShowFirstRunBubble(); | 5495 window_->GetLocationBar()->ShowFirstRunBubble(); |
| 5496 } else { | 5496 } else { |
| 5497 GlobalErrorService* service = | 5497 GlobalErrorService* service = |
| 5498 GlobalErrorServiceFactory::GetForProfile(profile()); | 5498 GlobalErrorServiceFactory::GetForProfile(profile()); |
| 5499 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5499 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
| 5500 if (error) | 5500 if (error) |
| 5501 error->ShowBubbleView(this); | 5501 error->ShowBubbleView(this); |
| 5502 } | 5502 } |
| 5503 } | 5503 } |
| OLD | NEW |