| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
| (...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 *success = false; | 1824 *success = false; |
| 1825 if (browser_tracker_->ContainsHandle(handle)) { | 1825 if (browser_tracker_->ContainsHandle(handle)) { |
| 1826 Browser* browser = browser_tracker_->GetResource(handle); | 1826 Browser* browser = browser_tracker_->GetResource(handle); |
| 1827 browser->profile()->GetPrefs()->SetBoolean(name.c_str(), value); | 1827 browser->profile()->GetPrefs()->SetBoolean(name.c_str(), value); |
| 1828 *success = true; | 1828 *success = true; |
| 1829 } | 1829 } |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 // Gets the current used encoding name of the page in the specified tab. | 1832 // Gets the current used encoding name of the page in the specified tab. |
| 1833 void AutomationProvider::GetPageCurrentEncoding( | 1833 void AutomationProvider::GetPageCurrentEncoding( |
| 1834 int tab_handle, std::wstring* current_encoding) { | 1834 int tab_handle, std::string* current_encoding) { |
| 1835 if (tab_tracker_->ContainsHandle(tab_handle)) { | 1835 if (tab_tracker_->ContainsHandle(tab_handle)) { |
| 1836 NavigationController* nav = tab_tracker_->GetResource(tab_handle); | 1836 NavigationController* nav = tab_tracker_->GetResource(tab_handle); |
| 1837 Browser* browser = FindAndActivateTab(nav); | 1837 Browser* browser = FindAndActivateTab(nav); |
| 1838 DCHECK(browser); | 1838 DCHECK(browser); |
| 1839 | 1839 |
| 1840 if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) | 1840 if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) |
| 1841 *current_encoding = nav->tab_contents()->encoding(); | 1841 *current_encoding = nav->tab_contents()->encoding(); |
| 1842 } | 1842 } |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 // Gets the current used encoding name of the page in the specified tab. | 1845 // Gets the current used encoding name of the page in the specified tab. |
| 1846 void AutomationProvider::OverrideEncoding(int tab_handle, | 1846 void AutomationProvider::OverrideEncoding(int tab_handle, |
| 1847 const std::wstring& encoding_name, | 1847 const std::string& encoding_name, |
| 1848 bool* success) { | 1848 bool* success) { |
| 1849 *success = false; | 1849 *success = false; |
| 1850 #if defined(OS_WIN) | 1850 #if defined(OS_WIN) |
| 1851 if (tab_tracker_->ContainsHandle(tab_handle)) { | 1851 if (tab_tracker_->ContainsHandle(tab_handle)) { |
| 1852 NavigationController* nav = tab_tracker_->GetResource(tab_handle); | 1852 NavigationController* nav = tab_tracker_->GetResource(tab_handle); |
| 1853 Browser* browser = FindAndActivateTab(nav); | 1853 Browser* browser = FindAndActivateTab(nav); |
| 1854 DCHECK(browser); | 1854 DCHECK(browser); |
| 1855 | 1855 |
| 1856 if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) { | 1856 if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) { |
| 1857 TabContents* tab_contents = nav->tab_contents(); | 1857 TabContents* tab_contents = nav->tab_contents(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 for (;iter != BrowserList::end(); ++iter) { | 2058 for (;iter != BrowserList::end(); ++iter) { |
| 2059 gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle(); | 2059 gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle(); |
| 2060 if (window == this_window) { | 2060 if (window == this_window) { |
| 2061 // Add() returns the existing handle for the resource if any. | 2061 // Add() returns the existing handle for the resource if any. |
| 2062 *browser_handle = browser_tracker_->Add(*iter); | 2062 *browser_handle = browser_tracker_->Add(*iter); |
| 2063 *success = true; | 2063 *success = true; |
| 2064 return; | 2064 return; |
| 2065 } | 2065 } |
| 2066 } | 2066 } |
| 2067 } | 2067 } |
| OLD | NEW |