diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.cc | 4 | ||||
-rw-r--r-- | chrome/browser/browser.h | 7 | ||||
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.cc | 10 | ||||
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.h | 14 | ||||
-rw-r--r-- | chrome/browser/task_manager.cc | 25 | ||||
-rw-r--r-- | chrome/browser/task_manager.h | 14 | ||||
-rw-r--r-- | chrome/browser/webdata/web_data_service.cc | 2 | ||||
-rw-r--r-- | chrome/browser/webdata/web_data_service.h | 2 | ||||
-rw-r--r-- | chrome/browser/webdata/web_database.cc | 16 | ||||
-rw-r--r-- | chrome/browser/webdata/web_database.h | 17 |
10 files changed, 55 insertions, 56 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 5e1b4ca..f1b3a5b 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -2400,7 +2400,7 @@ void Browser::ProcessPendingTabs() { } } -bool Browser::HasCompletedUnloadProcessing() { +bool Browser::HasCompletedUnloadProcessing() const { return is_attempting_to_close_browser_ && tabs_needing_before_unload_fired_.empty() && tabs_needing_unload_fired_.empty(); @@ -2465,7 +2465,7 @@ void Browser::BuildPopupWindow(TabContents* source, gfx::Rect(), true); } -GURL Browser::GetHomePage() { +GURL Browser::GetHomePage() const { if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) return GURL(chrome::kChromeUINewTabURL); GURL home_page = GURL(URLFixerUpper::FixupURL( diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index bb91b29..d41b537 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -497,9 +497,6 @@ class Browser : public TabStripModelDelegate, // the LocationBarView's edit. friend class AutomationProvider; - // Getters for the location bar and go button. - GoButton* GetGoButton(); - // Returns the StatusBubble from the current toolbar. It is possible for // this to return NULL if called before the toolbar has initialized. // TODO(beng): remove this. @@ -526,7 +523,7 @@ class Browser : public TabStripModelDelegate, void ProcessPendingTabs(); // Whether we've completed firing all the tabs' beforeunload/unload events. - bool HasCompletedUnloadProcessing(); + bool HasCompletedUnloadProcessing() const; // Clears all the state associated with processing tabs' beforeunload/unload // events since the user cancelled closing the window. @@ -558,7 +555,7 @@ class Browser : public TabStripModelDelegate, // Returns what the user's home page is, or the new tab page if the home page // has not been set. - GURL GetHomePage(); + GURL GetHomePage() const; // Shows the Find Bar, optionally selecting the next entry that matches the // existing search string for that Tab. |forward_direction| controls the diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 36b8f52..823b49e 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -246,7 +246,7 @@ NavigationController* TabStripModel::GetOpenerOfTabContentsAt(int index) { } int TabStripModel::GetIndexOfNextTabContentsOpenedBy( - NavigationController* opener, int start_index, bool use_group) { + const NavigationController* opener, int start_index, bool use_group) const { DCHECK(opener); DCHECK(ContainsIndex(start_index)); @@ -272,7 +272,7 @@ int TabStripModel::GetIndexOfNextTabContentsOpenedBy( } int TabStripModel::GetIndexOfLastTabContentsOpenedBy( - NavigationController* opener, int start_index) { + const NavigationController* opener, int start_index) const { DCHECK(opener); DCHECK(ContainsIndex(start_index)); @@ -418,7 +418,7 @@ void TabStripModel::TearOffTabContents(TabContents* detached_contents, // Context menu functions. bool TabStripModel::IsContextMenuCommandEnabled( - int context_index, ContextMenuCommand command_id) { + int context_index, ContextMenuCommand command_id) const { DCHECK(command_id > CommandFirst && command_id < CommandLast); switch (command_id) { case CommandNewTab: @@ -588,8 +588,8 @@ void TabStripModel::SetOpenerForContents(TabContents* contents, } // static -bool TabStripModel::OpenerMatches(TabContentsData* data, - NavigationController* opener, +bool TabStripModel::OpenerMatches(const TabContentsData* data, + const NavigationController* opener, bool use_group) { return data->opener == opener || (use_group && data->group == opener); } diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h index ca90db4..ab229da 100644 --- a/chrome/browser/tabs/tab_strip_model.h +++ b/chrome/browser/tabs/tab_strip_model.h @@ -303,14 +303,14 @@ class TabStripModel : public NotificationObserver { // If |use_group| is true, the group property of the tab is used instead of // the opener to find the next tab. Under some circumstances the group // relationship may exist but the opener may not. - int GetIndexOfNextTabContentsOpenedBy(NavigationController* opener, + int GetIndexOfNextTabContentsOpenedBy(const NavigationController* opener, int start_index, - bool use_group); + bool use_group) const; // Returns the index of the last TabContents in the model opened by the // specified opener, starting at |start_index|. - int GetIndexOfLastTabContentsOpenedBy(NavigationController* opener, - int start_index); + int GetIndexOfLastTabContentsOpenedBy(const NavigationController* opener, + int start_index) const; // Called by the Browser when a navigation is about to occur in the specified // TabContents. Depending on the tab, and the transition type of the @@ -384,7 +384,7 @@ class TabStripModel : public NotificationObserver { // Returns true if the specified command is enabled. bool IsContextMenuCommandEnabled(int context_index, - ContextMenuCommand command_id); + ContextMenuCommand command_id) const; // Performs the action associated with the specified command for the given // TabStripModel index |context_index|. @@ -445,8 +445,8 @@ class TabStripModel : public NotificationObserver { // that matches the specified one. If |use_group| is true, then this will // fall back to check the group relationship as well. struct TabContentsData; - static bool OpenerMatches(TabContentsData* data, - NavigationController* opener, + static bool OpenerMatches(const TabContentsData* data, + const NavigationController* opener, bool use_group); // Our delegate. diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index ab7c562..c0f189b 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -165,35 +165,36 @@ std::wstring TaskManagerTableModel::GetText(int row, int col_id) { } } -int64 TaskManagerTableModel::GetNetworkUsage(TaskManager::Resource* resource) { +int64 TaskManagerTableModel::GetNetworkUsage(TaskManager::Resource* resource) + const { int64 net_usage = GetNetworkUsageForResource(resource); if (net_usage == 0 && !resource->SupportNetworkUsage()) return -1; return net_usage; } -int TaskManagerTableModel::GetCPUUsage(TaskManager::Resource* resource) { +int TaskManagerTableModel::GetCPUUsage(TaskManager::Resource* resource) const { CPUUsageMap::const_iterator iter = cpu_usage_map_.find(resource->GetProcess()); - if (iter == cpu_usage_map_.end()) - return 0; - return iter->second; + if (iter == cpu_usage_map_.end()) + return 0; + return iter->second; } size_t TaskManagerTableModel::GetPrivateMemory( - base::ProcessMetrics* process_metrics) { + const base::ProcessMetrics* process_metrics) const { return process_metrics->GetPrivateBytes() / 1024; } size_t TaskManagerTableModel::GetSharedMemory( - base::ProcessMetrics* process_metrics) { + const base::ProcessMetrics* process_metrics) const { base::WorkingSetKBytes ws_usage; process_metrics->GetWorkingSetKBytes(&ws_usage); return ws_usage.shared; } size_t TaskManagerTableModel::GetPhysicalMemory( - base::ProcessMetrics* process_metrics) { + const base::ProcessMetrics* process_metrics) const { // Memory = working_set.private + working_set.shareable. // We exclude the shared memory. size_t total_kbytes = process_metrics->GetWorkingSetSize() / 1024; @@ -203,8 +204,8 @@ size_t TaskManagerTableModel::GetPhysicalMemory( return total_kbytes; } -int TaskManagerTableModel::GetStatsValue(TaskManager::Resource* resource, - int col_id) { +int TaskManagerTableModel::GetStatsValue(const TaskManager::Resource* resource, + int col_id) const { StatsTable* table = StatsTable::current(); if (table != NULL) { const char* counter = table->GetRowName(col_id); @@ -558,8 +559,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) { } int64 TaskManagerTableModel::GetNetworkUsageForResource( - TaskManager::Resource* resource) { - ResourceValueMap::iterator iter = + TaskManager::Resource* resource) const { + ResourceValueMap::const_iterator iter = displayed_network_usage_map_.find(resource); if (iter == displayed_network_usage_map_.end()) return 0; diff --git a/chrome/browser/task_manager.h b/chrome/browser/task_manager.h index 8f67eb8..717dcf2 100644 --- a/chrome/browser/task_manager.h +++ b/chrome/browser/task_manager.h @@ -238,7 +238,7 @@ class TaskManagerTableModel : public views::GroupTableModel, // Returns the network usage (in bytes per seconds) for the specified // resource. That's the value retrieved at the last timer's tick. - int64 GetNetworkUsageForResource(TaskManager::Resource* resource); + int64 GetNetworkUsageForResource(TaskManager::Resource* resource) const; // Called on the UI thread when some bytes are read. void BytesRead(BytesReadParam param); @@ -246,27 +246,27 @@ class TaskManagerTableModel : public views::GroupTableModel, // Returns the network usage (in byte per second) that should be displayed for // the passed |resource|. -1 means the information is not available for that // resource. - int64 GetNetworkUsage(TaskManager::Resource* resource); + int64 GetNetworkUsage(TaskManager::Resource* resource) const; // Returns the CPU usage (in %) that should be displayed for the passed // |resource|. - int GetCPUUsage(TaskManager::Resource* resource); + int GetCPUUsage(TaskManager::Resource* resource) const; // Retrieves the private memory (in KB) that should be displayed from the // passed |process_metrics|. - size_t GetPrivateMemory(base::ProcessMetrics* process_metrics); + size_t GetPrivateMemory(const base::ProcessMetrics* process_metrics) const; // Returns the shared memory (in KB) that should be displayed from the passed // |process_metrics|. - size_t GetSharedMemory(base::ProcessMetrics* process_metrics); + size_t GetSharedMemory(const base::ProcessMetrics* process_metrics) const; // Returns the pysical memory (in KB) that should be displayed from the passed // |process_metrics|. - size_t GetPhysicalMemory(base::ProcessMetrics* process_metrics); + size_t GetPhysicalMemory(const base::ProcessMetrics* process_metrics) const; // Returns the stat value at the column |col_id| that should be displayed from // the passed |process_metrics|. - int GetStatsValue(TaskManager::Resource* resource, int col_id); + int GetStatsValue(const TaskManager::Resource* resource, int col_id) const; // Retrieves the ProcessMetrics for the resources at the specified rows. // Returns true if there was a ProcessMetrics available for both rows. diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc index 4f0dece..e514847 100644 --- a/chrome/browser/webdata/web_data_service.cc +++ b/chrome/browser/webdata/web_data_service.cc @@ -79,7 +79,7 @@ void WebDataService::Shutdown() { } } -bool WebDataService::IsRunning() { +bool WebDataService::IsRunning() const { return thread_ != NULL; } diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index efeaf05..08c0dbe 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -153,7 +153,7 @@ class WebDataService : public base::RefCountedThreadSafe<WebDataService> { void Shutdown(); // Returns false if Shutdown() has been called. - bool IsRunning(); + bool IsRunning() const; ////////////////////////////////////////////////////////////////////////////// // diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index b9b64f3..fe9fb5f 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -224,7 +224,7 @@ bool WebDatabase::SetWebAppImage(const GURL& url, } bool WebDatabase::GetWebAppImages(const GURL& url, - std::vector<SkBitmap>* images) { + std::vector<SkBitmap>* images) const { SQLStatement s; if (s.prepare(db_, "SELECT image FROM web_app_icons WHERE url=?") != SQLITE_OK) { @@ -259,7 +259,7 @@ bool WebDatabase::SetWebAppHasAllImages(const GURL& url, return (s.step() == SQLITE_DONE); } -bool WebDatabase::GetWebAppHasAllImages(const GURL& url) { +bool WebDatabase::GetWebAppHasAllImages(const GURL& url) const { SQLStatement s; if (s.prepare(db_, "SELECT has_all_images FROM web_apps " "WHERE url=?") != SQLITE_OK) { @@ -524,7 +524,7 @@ bool WebDatabase::RemoveKeyword(TemplateURL::IDType id) { return s.step() == SQLITE_DONE; } -bool WebDatabase::GetKeywords(std::vector<TemplateURL*>* urls) { +bool WebDatabase::GetKeywords(std::vector<TemplateURL*>* urls) const { SQLStatement s; if (s.prepare(db_, "SELECT id, short_name, keyword, favicon_url, url, " @@ -784,7 +784,7 @@ static void InitPasswordFormFromStatement(PasswordForm* form, } bool WebDatabase::GetLogins(const PasswordForm& form, - std::vector<PasswordForm*>* forms) { + std::vector<PasswordForm*>* forms) const { DCHECK(forms); SQLStatement s; if (s.prepare(db_, @@ -812,7 +812,7 @@ bool WebDatabase::GetLogins(const PasswordForm& form, } bool WebDatabase::GetAllLogins(std::vector<PasswordForm*>* forms, - bool include_blacklisted) { + bool include_blacklisted) const { DCHECK(forms); SQLStatement s; std::string stmt = "SELECT origin_url, action_url, " @@ -876,7 +876,7 @@ bool WebDatabase::ClearAutofillEmptyValueElements() { } bool WebDatabase::GetIDAndCountOfFormElement( - const AutofillForm::Element& element, int64* pair_id, int* count) { + const AutofillForm::Element& element, int64* pair_id, int* count) const { SQLStatement s; if (s.prepare(db_, "SELECT pair_id, count FROM autofill " @@ -900,7 +900,7 @@ bool WebDatabase::GetIDAndCountOfFormElement( return true; } -bool WebDatabase::GetCountOfFormElement(int64 pair_id, int* count) { +bool WebDatabase::GetCountOfFormElement(int64 pair_id, int* count) const { SQLStatement s; if (s.prepare(db_, "SELECT count FROM autofill " @@ -1010,7 +1010,7 @@ bool WebDatabase::AddAutofillFormElement(const AutofillForm::Element& element) { bool WebDatabase::GetFormValuesForElementName(const std::wstring& name, const std::wstring& prefix, std::vector<std::wstring>* values, - int limit) { + int limit) const { DCHECK(values); SQLStatement s; diff --git a/chrome/browser/webdata/web_database.h b/chrome/browser/webdata/web_database.h index 3584701..04250d9 100644 --- a/chrome/browser/webdata/web_database.h +++ b/chrome/browser/webdata/web_database.h @@ -59,7 +59,7 @@ class WebDatabase { // Loads the keywords into the specified vector. It's up to the caller to // delete the returned objects. // Returns true on success. - bool GetKeywords(std::vector<TemplateURL*>* urls); + bool GetKeywords(std::vector<TemplateURL*>* urls) const; // Updates the database values for the specified url. // Returns true on success. @@ -108,14 +108,15 @@ class WebDatabase { // Loads a list of matching password forms into the specified vector |forms|. // The list will contain all possibly relevant entries to the observed |form|, // including blacklisted matches. - bool GetLogins(const PasswordForm& form, std::vector<PasswordForm*>* forms); + bool GetLogins(const PasswordForm& form, + std::vector<PasswordForm*>* forms) const; // Loads the complete list of password forms into the specified vector |forms| // if include_blacklisted is true, otherwise only loads those which are // actually autofillable; i.e haven't been blacklisted by the user selecting // the 'Never for this site' button. bool GetAllLogins(std::vector<PasswordForm*>* forms, - bool include_blacklisted); + bool include_blacklisted) const; ////////////////////////////////////////////////////////////////////////////// // @@ -137,7 +138,7 @@ class WebDatabase { bool GetFormValuesForElementName(const std::wstring& name, const std::wstring& prefix, std::vector<std::wstring>* values, - int limit); + int limit) const; // Removes rows from autofill_dates if they were created on or after // |delete_begin| and strictly before |delete_end|. Decrements the count of @@ -161,11 +162,11 @@ class WebDatabase { // |element|. Sets *count to 0 if there is no such row in the table. bool GetIDAndCountOfFormElement(const AutofillForm::Element& element, int64* pair_id, - int* count); + int* count) const; // Gets the count only given the pair_id. bool GetCountOfFormElement(int64 pair_id, - int* count); + int* count) const; // Updates the count entry in the row corresponding to |pair_id| to |count|. bool SetCountOfFormElement(int64 pair_id, int count); @@ -190,10 +191,10 @@ class WebDatabase { ////////////////////////////////////////////////////////////////////////////// bool SetWebAppImage(const GURL& url, const SkBitmap& image); - bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images); + bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images) const; bool SetWebAppHasAllImages(const GURL& url, bool has_all_images); - bool GetWebAppHasAllImages(const GURL& url); + bool GetWebAppHasAllImages(const GURL& url) const; bool RemoveWebApp(const GURL& url); |