| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2939 bool Browser::IsApplication() const { | 2939 bool Browser::IsApplication() const { |
| 2940 return (type_ & TYPE_APP) != 0; | 2940 return (type_ & TYPE_APP) != 0; |
| 2941 } | 2941 } |
| 2942 | 2942 |
| 2943 void Browser::ConvertContentsToApplication(TabContents* contents) { | 2943 void Browser::ConvertContentsToApplication(TabContents* contents) { |
| 2944 const GURL& url = contents->controller().GetActiveEntry()->url(); | 2944 const GURL& url = contents->controller().GetActiveEntry()->url(); |
| 2945 std::string app_name = web_app::GenerateApplicationNameFromURL(url); | 2945 std::string app_name = web_app::GenerateApplicationNameFromURL(url); |
| 2946 RegisterAppPrefs(app_name); | 2946 RegisterAppPrefs(app_name); |
| 2947 | 2947 |
| 2948 DetachContents(contents); | 2948 DetachContents(contents); |
| 2949 Browser* browser = Browser::CreateForApp(app_name, NULL, profile_, false); | 2949 Browser* app_browser = Browser::CreateForApp(app_name, NULL, profile_, false); |
| 2950 TabContentsWrapper* wrapper = new TabContentsWrapper(contents); | 2950 TabContentsWrapper* wrapper = new TabContentsWrapper(contents); |
| 2951 browser->tabstrip_model()->AppendTabContents(wrapper, true); | 2951 app_browser->tabstrip_model()->AppendTabContents(wrapper, true); |
| 2952 TabContents* tab_contents = GetSelectedTabContents(); | 2952 |
| 2953 tab_contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 2953 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 2954 tab_contents->render_view_host()->SyncRendererPrefs(); | 2954 contents->render_view_host()->SyncRendererPrefs(); |
| 2955 browser->window()->Show(); | 2955 app_browser->window()->Show(); |
| 2956 } | 2956 } |
| 2957 | 2957 |
| 2958 bool Browser::ShouldDisplayURLField() { | 2958 bool Browser::ShouldDisplayURLField() { |
| 2959 return !IsApplication(); | 2959 return !IsApplication(); |
| 2960 } | 2960 } |
| 2961 | 2961 |
| 2962 void Browser::BeforeUnloadFired(TabContents* tab, | 2962 void Browser::BeforeUnloadFired(TabContents* tab, |
| 2963 bool proceed, | 2963 bool proceed, |
| 2964 bool* proceed_to_fire_unload) { | 2964 bool* proceed_to_fire_unload) { |
| 2965 if (!is_attempting_to_close_browser_) { | 2965 if (!is_attempting_to_close_browser_) { |
| (...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4136 NOTREACHED(); | 4136 NOTREACHED(); |
| 4137 return false; | 4137 return false; |
| 4138 } | 4138 } |
| 4139 | 4139 |
| 4140 void Browser::CreateInstantIfNecessary() { | 4140 void Browser::CreateInstantIfNecessary() { |
| 4141 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && | 4141 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && |
| 4142 !profile()->IsOffTheRecord()) { | 4142 !profile()->IsOffTheRecord()) { |
| 4143 instant_.reset(new InstantController(profile_, this)); | 4143 instant_.reset(new InstantController(profile_, this)); |
| 4144 } | 4144 } |
| 4145 } | 4145 } |
| OLD | NEW |