| 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/browser.h" | 5 #include "chrome/browser/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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 const float kPopupMaxHeightFactor = 0.6; | 168 const float kPopupMaxHeightFactor = 0.6; |
| 169 #endif | 169 #endif |
| 170 | 170 |
| 171 // Returns true if the specified TabContents has unload listeners registered. | 171 // Returns true if the specified TabContents has unload listeners registered. |
| 172 bool TabHasUnloadListener(TabContents* contents) { | 172 bool TabHasUnloadListener(TabContents* contents) { |
| 173 return contents->notify_disconnection() && | 173 return contents->notify_disconnection() && |
| 174 !contents->showing_interstitial_page() && | 174 !contents->showing_interstitial_page() && |
| 175 !contents->render_view_host()->SuddenTerminationAllowed(); | 175 !contents->render_view_host()->SuddenTerminationAllowed(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // Returns true if two URLs are equal ignoring their ref (hash fragment). | |
| 179 bool CompareURLsIgnoreRef(const GURL& url, const GURL& other) { | |
| 180 if (url == other) | |
| 181 return true; | |
| 182 // If neither has a ref than there is no point in stripping the refs and | |
| 183 // the URLs are different since the comparison failed in the previous if | |
| 184 // statement. | |
| 185 if (!url.has_ref() && !other.has_ref()) | |
| 186 return false; | |
| 187 url_canon::Replacements<char> replacements; | |
| 188 replacements.ClearRef(); | |
| 189 GURL url_no_ref = url.ReplaceComponents(replacements); | |
| 190 GURL other_no_ref = other.ReplaceComponents(replacements); | |
| 191 return url_no_ref == other_no_ref; | |
| 192 } | |
| 193 | |
| 194 } // namespace | 178 } // namespace |
| 195 | 179 |
| 196 extern bool g_log_bug53991; | 180 extern bool g_log_bug53991; |
| 197 | 181 |
| 198 /////////////////////////////////////////////////////////////////////////////// | 182 /////////////////////////////////////////////////////////////////////////////// |
| 199 // Browser, Constructors, Creation, Showing: | 183 // Browser, Constructors, Creation, Showing: |
| 200 | 184 |
| 201 Browser::Browser(Type type, Profile* profile) | 185 Browser::Browser(Type type, Profile* profile) |
| 202 : type_(type), | 186 : type_(type), |
| 203 profile_(profile), | 187 profile_(profile), |
| (...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4080 NOTREACHED(); | 4064 NOTREACHED(); |
| 4081 return false; | 4065 return false; |
| 4082 } | 4066 } |
| 4083 | 4067 |
| 4084 void Browser::CreateInstantIfNecessary() { | 4068 void Browser::CreateInstantIfNecessary() { |
| 4085 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && | 4069 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && |
| 4086 !profile()->IsOffTheRecord()) { | 4070 !profile()->IsOffTheRecord()) { |
| 4087 instant_.reset(new InstantController(profile_, this)); | 4071 instant_.reset(new InstantController(profile_, this)); |
| 4088 } | 4072 } |
| 4089 } | 4073 } |
| OLD | NEW |