| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/idle_timer.h" | 8 #include "base/idle_timer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 313 } |
| 314 | 314 |
| 315 // static | 315 // static |
| 316 void Browser::OpenApplicationWindow(Profile* profile, const GURL& url) { | 316 void Browser::OpenApplicationWindow(Profile* profile, const GURL& url) { |
| 317 std::wstring app_name = ComputeApplicationNameFromURL(url); | 317 std::wstring app_name = ComputeApplicationNameFromURL(url); |
| 318 RegisterAppPrefs(app_name); | 318 RegisterAppPrefs(app_name); |
| 319 | 319 |
| 320 Browser* browser = Browser::CreateForApp(app_name, profile); | 320 Browser* browser = Browser::CreateForApp(app_name, profile); |
| 321 browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE, true, NULL); | 321 browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE, true, NULL); |
| 322 browser->window()->Show(); | 322 browser->window()->Show(); |
| 323 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial |
| 324 // focus explicitly. |
| 325 browser->GetSelectedTabContents()->SetInitialFocus(); |
| 323 } | 326 } |
| 324 | 327 |
| 325 /////////////////////////////////////////////////////////////////////////////// | 328 /////////////////////////////////////////////////////////////////////////////// |
| 326 // Browser, State Storage and Retrieval for UI: | 329 // Browser, State Storage and Retrieval for UI: |
| 327 | 330 |
| 328 std::wstring Browser::GetWindowPlacementKey() const { | 331 std::wstring Browser::GetWindowPlacementKey() const { |
| 329 std::wstring name(prefs::kBrowserWindowPlacement); | 332 std::wstring name(prefs::kBrowserWindowPlacement); |
| 330 if (!app_name_.empty()) { | 333 if (!app_name_.empty()) { |
| 331 name.append(L"_"); | 334 name.append(L"_"); |
| 332 name.append(app_name_); | 335 name.append(app_name_); |
| (...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 | 2429 |
| 2427 // We need to register the window position pref. | 2430 // We need to register the window position pref. |
| 2428 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2431 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
| 2429 window_pref.append(L"_"); | 2432 window_pref.append(L"_"); |
| 2430 window_pref.append(app_name); | 2433 window_pref.append(app_name); |
| 2431 PrefService* prefs = g_browser_process->local_state(); | 2434 PrefService* prefs = g_browser_process->local_state(); |
| 2432 DCHECK(prefs); | 2435 DCHECK(prefs); |
| 2433 | 2436 |
| 2434 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2437 prefs->RegisterDictionaryPref(window_pref.c_str()); |
| 2435 } | 2438 } |
| OLD | NEW |