| 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 window_ = CreateBrowserWindow(); | 531 window_ = CreateBrowserWindow(); |
| 532 fullscreen_controller_ = new FullscreenController(window_, profile_, this); | 532 fullscreen_controller_ = new FullscreenController(window_, profile_, this); |
| 533 | 533 |
| 534 #if defined(OS_WIN) && !defined(USE_AURA) | 534 #if defined(OS_WIN) && !defined(USE_AURA) |
| 535 // Set the app user model id for this application to that of the application | 535 // Set the app user model id for this application to that of the application |
| 536 // name. See http://crbug.com/7028. | 536 // name. See http://crbug.com/7028. |
| 537 ui::win::SetAppIdForWindow( | 537 ui::win::SetAppIdForWindow( |
| 538 is_app() && !is_type_panel() ? | 538 is_app() && !is_type_panel() ? |
| 539 ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) : | 539 ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) : |
| 540 ShellIntegration::GetChromiumAppId(profile_->GetPath()), | 540 ShellIntegration::GetChromiumAppId(profile_->GetPath()), |
| 541 window()->GetNativeHandle()); | 541 window()->GetNativeWindow()); |
| 542 | 542 |
| 543 if (is_type_panel()) { | 543 if (is_type_panel()) { |
| 544 ui::win::SetAppIconForWindow(ShellIntegration::GetChromiumIconPath(), | 544 ui::win::SetAppIconForWindow(ShellIntegration::GetChromiumIconPath(), |
| 545 window()->GetNativeHandle()); | 545 window()->GetNativeWindow()); |
| 546 } | 546 } |
| 547 #endif | 547 #endif |
| 548 | 548 |
| 549 // Create the extension window controller before sending notifications. | 549 // Create the extension window controller before sending notifications. |
| 550 extension_window_controller_.reset( | 550 extension_window_controller_.reset( |
| 551 new BrowserExtensionWindowController(this)); | 551 new BrowserExtensionWindowController(this)); |
| 552 | 552 |
| 553 content::NotificationService::current()->Notify( | 553 content::NotificationService::current()->Notify( |
| 554 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 554 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 555 content::Source<Browser>(this), | 555 content::Source<Browser>(this), |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 void Browser::CloseTabContents(WebContents* contents) { | 1202 void Browser::CloseTabContents(WebContents* contents) { |
| 1203 CloseContents(contents); | 1203 CloseContents(contents); |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 gfx::NativeWindow Browser::BrowserShowWebDialog( | 1206 gfx::NativeWindow Browser::BrowserShowWebDialog( |
| 1207 WebDialogDelegate* delegate, | 1207 WebDialogDelegate* delegate, |
| 1208 gfx::NativeWindow parent_window) { | 1208 gfx::NativeWindow parent_window) { |
| 1209 if (!parent_window) | 1209 if (!parent_window) |
| 1210 parent_window = window_->GetNativeHandle(); | 1210 parent_window = window_->GetNativeWindow(); |
| 1211 | 1211 |
| 1212 return browser::ShowWebDialog(parent_window, profile_, this, delegate); | 1212 return browser::ShowWebDialog(parent_window, profile_, this, delegate); |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 void Browser::BrowserRenderWidgetShowing() { | 1215 void Browser::BrowserRenderWidgetShowing() { |
| 1216 RenderWidgetShowing(); | 1216 RenderWidgetShowing(); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 void Browser::BookmarkBarSizeChanged(bool is_animating) { | 1219 void Browser::BookmarkBarSizeChanged(bool is_animating) { |
| 1220 window_->ToolbarSizeChanged(is_animating); | 1220 window_->ToolbarSizeChanged(is_animating); |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 } | 1785 } |
| 1786 | 1786 |
| 1787 void Browser::OpenFile() { | 1787 void Browser::OpenFile() { |
| 1788 content::RecordAction(UserMetricsAction("OpenFile")); | 1788 content::RecordAction(UserMetricsAction("OpenFile")); |
| 1789 if (!select_file_dialog_.get()) | 1789 if (!select_file_dialog_.get()) |
| 1790 select_file_dialog_ = SelectFileDialog::Create(this); | 1790 select_file_dialog_ = SelectFileDialog::Create(this); |
| 1791 | 1791 |
| 1792 const FilePath directory = profile_->last_selected_directory(); | 1792 const FilePath directory = profile_->last_selected_directory(); |
| 1793 | 1793 |
| 1794 // TODO(beng): figure out how to juggle this. | 1794 // TODO(beng): figure out how to juggle this. |
| 1795 gfx::NativeWindow parent_window = window_->GetNativeHandle(); | 1795 gfx::NativeWindow parent_window = window_->GetNativeWindow(); |
| 1796 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, | 1796 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, |
| 1797 string16(), directory, | 1797 string16(), directory, |
| 1798 NULL, 0, FILE_PATH_LITERAL(""), | 1798 NULL, 0, FILE_PATH_LITERAL(""), |
| 1799 GetActiveWebContents(), | 1799 GetActiveWebContents(), |
| 1800 parent_window, NULL); | 1800 parent_window, NULL); |
| 1801 } | 1801 } |
| 1802 | 1802 |
| 1803 void Browser::OpenCreateShortcutsDialog() { | 1803 void Browser::OpenCreateShortcutsDialog() { |
| 1804 content::RecordAction(UserMetricsAction("CreateShortcut")); | 1804 content::RecordAction(UserMetricsAction("CreateShortcut")); |
| 1805 #if !defined(OS_MACOSX) | 1805 #if !defined(OS_MACOSX) |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2405 // displaying a favicon, which controls the throbber. If we updated it here, | 2405 // displaying a favicon, which controls the throbber. If we updated it here, |
| 2406 // the throbber will show the default favicon for a split second when | 2406 // the throbber will show the default favicon for a split second when |
| 2407 // navigating away from the new tab page. | 2407 // navigating away from the new tab page. |
| 2408 ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL); | 2408 ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL); |
| 2409 | 2409 |
| 2410 if (contents_is_selected) | 2410 if (contents_is_selected) |
| 2411 contents->web_contents()->Focus(); | 2411 contents->web_contents()->Focus(); |
| 2412 } | 2412 } |
| 2413 | 2413 |
| 2414 void Browser::ShowCollectedCookiesDialog(TabContents* tab_contents) { | 2414 void Browser::ShowCollectedCookiesDialog(TabContents* tab_contents) { |
| 2415 browser::ShowCollectedCookiesDialog(window()->GetNativeHandle(), | 2415 browser::ShowCollectedCookiesDialog(window()->GetNativeWindow(), |
| 2416 tab_contents); | 2416 tab_contents); |
| 2417 } | 2417 } |
| 2418 | 2418 |
| 2419 /////////////////////////////////////////////////////////////////////////////// | 2419 /////////////////////////////////////////////////////////////////////////////// |
| 2420 // Browser, PageNavigator implementation: | 2420 // Browser, PageNavigator implementation: |
| 2421 | 2421 |
| 2422 WebContents* Browser::OpenURL(const OpenURLParams& params) { | 2422 WebContents* Browser::OpenURL(const OpenURLParams& params) { |
| 2423 return OpenURLFromTab(NULL, params); | 2423 return OpenURLFromTab(NULL, params); |
| 2424 } | 2424 } |
| 2425 | 2425 |
| (...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5173 if (contents && !allow_js_access) { | 5173 if (contents && !allow_js_access) { |
| 5174 contents->web_contents()->GetController().LoadURL( | 5174 contents->web_contents()->GetController().LoadURL( |
| 5175 target_url, | 5175 target_url, |
| 5176 content::Referrer(), | 5176 content::Referrer(), |
| 5177 content::PAGE_TRANSITION_LINK, | 5177 content::PAGE_TRANSITION_LINK, |
| 5178 std::string()); // No extra headers. | 5178 std::string()); // No extra headers. |
| 5179 } | 5179 } |
| 5180 | 5180 |
| 5181 return contents != NULL; | 5181 return contents != NULL; |
| 5182 } | 5182 } |
| OLD | NEW |