| OLD | NEW |
| 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.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 // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 base::FilePath profile_path = profile_->GetPath(); | 415 base::FilePath profile_path = profile_->GetPath(); |
| 416 ProfileMetrics::LogProfileLaunch(profile_path); | 416 ProfileMetrics::LogProfileLaunch(profile_path); |
| 417 | 417 |
| 418 window_ = params.window ? params.window : CreateBrowserWindow(this); | 418 window_ = params.window ? params.window : CreateBrowserWindow(this); |
| 419 | 419 |
| 420 // TODO(beng): move to BrowserFrameWin. | 420 // TODO(beng): move to BrowserFrameWin. |
| 421 #if defined(OS_WIN) && !defined(USE_AURA) | 421 #if defined(OS_WIN) && !defined(USE_AURA) |
| 422 // Set the app user model id for this application to that of the application | 422 // Set the app user model id for this application to that of the application |
| 423 // name. See http://crbug.com/7028. | 423 // name. See http://crbug.com/7028. |
| 424 ui::win::SetAppIdForWindow( | 424 ui::win::SetAppIdForWindow( |
| 425 is_app() && !is_type_panel() ? | 425 is_app() ? |
| 426 ShellIntegration::GetAppModelIdForProfile(UTF8ToWide(app_name_), | 426 ShellIntegration::GetAppModelIdForProfile(UTF8ToWide(app_name_), |
| 427 profile_->GetPath()) : | 427 profile_->GetPath()) : |
| 428 ShellIntegration::GetChromiumModelIdForProfile(profile_->GetPath()), | 428 ShellIntegration::GetChromiumModelIdForProfile(profile_->GetPath()), |
| 429 window()->GetNativeWindow()); | 429 window()->GetNativeWindow()); |
| 430 | |
| 431 if (is_type_panel()) { | |
| 432 ui::win::SetAppIconForWindow(ShellIntegration::GetChromiumIconLocation(), | |
| 433 window()->GetNativeWindow()); | |
| 434 } | |
| 435 #endif | 430 #endif |
| 436 | 431 |
| 437 // Create the extension window controller before sending notifications. | 432 // Create the extension window controller before sending notifications. |
| 438 extension_window_controller_.reset( | 433 extension_window_controller_.reset( |
| 439 new BrowserExtensionWindowController(this)); | 434 new BrowserExtensionWindowController(this)); |
| 440 | 435 |
| 441 // TODO(beng): Move BrowserList::AddBrowser() to the end of this function and | 436 // TODO(beng): Move BrowserList::AddBrowser() to the end of this function and |
| 442 // replace uses of this with BL's notifications. | 437 // replace uses of this with BL's notifications. |
| 443 content::NotificationService::current()->Notify( | 438 content::NotificationService::current()->Notify( |
| 444 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 439 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 | 1330 |
| 1336 void Browser::MoveContents(WebContents* source, const gfx::Rect& pos) { | 1331 void Browser::MoveContents(WebContents* source, const gfx::Rect& pos) { |
| 1337 if (!IsPopupOrPanel(source)) { | 1332 if (!IsPopupOrPanel(source)) { |
| 1338 NOTREACHED() << "moving invalid browser type"; | 1333 NOTREACHED() << "moving invalid browser type"; |
| 1339 return; | 1334 return; |
| 1340 } | 1335 } |
| 1341 window_->SetBounds(pos); | 1336 window_->SetBounds(pos); |
| 1342 } | 1337 } |
| 1343 | 1338 |
| 1344 bool Browser::IsPopupOrPanel(const WebContents* source) const { | 1339 bool Browser::IsPopupOrPanel(const WebContents* source) const { |
| 1345 // A non-tabbed BROWSER is an unconstrained popup. | 1340 return is_type_popup(); |
| 1346 return is_type_popup() || is_type_panel(); | |
| 1347 } | 1341 } |
| 1348 | 1342 |
| 1349 void Browser::UpdateTargetURL(WebContents* source, int32 page_id, | 1343 void Browser::UpdateTargetURL(WebContents* source, int32 page_id, |
| 1350 const GURL& url) { | 1344 const GURL& url) { |
| 1351 if (!GetStatusBubble()) | 1345 if (!GetStatusBubble()) |
| 1352 return; | 1346 return; |
| 1353 | 1347 |
| 1354 if (source == tab_strip_model_->GetActiveWebContents()) { | 1348 if (source == tab_strip_model_->GetActiveWebContents()) { |
| 1355 PrefService* prefs = profile_->GetPrefs(); | 1349 PrefService* prefs = profile_->GetPrefs(); |
| 1356 GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages)); | 1350 GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages)); |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2238 if (contents && !allow_js_access) { | 2232 if (contents && !allow_js_access) { |
| 2239 contents->web_contents()->GetController().LoadURL( | 2233 contents->web_contents()->GetController().LoadURL( |
| 2240 target_url, | 2234 target_url, |
| 2241 content::Referrer(), | 2235 content::Referrer(), |
| 2242 content::PAGE_TRANSITION_LINK, | 2236 content::PAGE_TRANSITION_LINK, |
| 2243 std::string()); // No extra headers. | 2237 std::string()); // No extra headers. |
| 2244 } | 2238 } |
| 2245 | 2239 |
| 2246 return contents != NULL; | 2240 return contents != NULL; |
| 2247 } | 2241 } |
| OLD | NEW |