Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: chrome/browser/gtk/options/advanced_contents_gtk.cc

Issue 3052034: base: Rename EnvVarGetter to Environment. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: review Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/options/advanced_contents_gtk.h" 5 #include "chrome/browser/gtk/options/advanced_contents_gtk.h"
6 6
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <sys/wait.h> 8 #include <sys/wait.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "app/gtk_signal.h" 13 #include "app/gtk_signal.h"
14 #include "app/gtk_util.h" 14 #include "app/gtk_util.h"
15 #include "app/l10n_util.h" 15 #include "app/l10n_util.h"
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/env_var.h" 17 #include "base/environment.h"
18 #include "base/file_util.h" 18 #include "base/file_util.h"
19 #include "base/path_service.h" 19 #include "base/path_service.h"
20 #include "base/process_util.h" 20 #include "base/process_util.h"
21 #include "base/string_tokenizer.h" 21 #include "base/string_tokenizer.h"
22 #include "base/xdg_util.h" 22 #include "base/xdg_util.h"
23 #include "chrome/browser/browser_list.h" 23 #include "chrome/browser/browser_list.h"
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/download/download_manager.h" 25 #include "chrome/browser/download/download_manager.h"
26 #include "chrome/browser/fonts_languages_window.h" 26 #include "chrome/browser/fonts_languages_window.h"
27 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h" 27 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 gtk_widget_set_sensitive(change_proxies_button_, 414 gtk_widget_set_sensitive(change_proxies_button_,
415 !proxy_prefs_->IsManaged()); 415 !proxy_prefs_->IsManaged());
416 } 416 }
417 417
418 // static 418 // static
419 void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button, 419 void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button,
420 NetworkSection* section) { 420 NetworkSection* section) {
421 section->UserMetricsRecordAction(UserMetricsAction("Options_ChangeProxies"), 421 section->UserMetricsRecordAction(UserMetricsAction("Options_ChangeProxies"),
422 NULL); 422 NULL);
423 423
424 scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); 424 scoped_ptr<base::Environment> env(base::Environment::Create());
425 425
426 ProxyConfigCommand command; 426 ProxyConfigCommand command;
427 bool found_command = false; 427 bool found_command = false;
428 switch (base::GetDesktopEnvironment(env_getter.get())) { 428 switch (base::GetDesktopEnvironment(env.get())) {
429 case base::DESKTOP_ENVIRONMENT_GNOME: { 429 case base::DESKTOP_ENVIRONMENT_GNOME: {
430 size_t index; 430 size_t index;
431 ProxyConfigCommand commands[2]; 431 ProxyConfigCommand commands[2];
432 commands[0].argv = kGNOMEProxyConfigCommand; 432 commands[0].argv = kGNOMEProxyConfigCommand;
433 commands[1].argv = kOldGNOMEProxyConfigCommand; 433 commands[1].argv = kOldGNOMEProxyConfigCommand;
434 found_command = SearchPATH(commands, 2, &index); 434 found_command = SearchPATH(commands, 2, &index);
435 if (found_command) 435 if (found_command)
436 command = commands[index]; 436 command = commands[index];
437 break; 437 break;
438 } 438 }
439 439
440 case base::DESKTOP_ENVIRONMENT_KDE3: 440 case base::DESKTOP_ENVIRONMENT_KDE3:
441 command.argv = kKDE3ProxyConfigCommand; 441 command.argv = kKDE3ProxyConfigCommand;
442 found_command = SearchPATH(&command, 1, NULL); 442 found_command = SearchPATH(&command, 1, NULL);
443 break; 443 break;
444 444
445 case base::DESKTOP_ENVIRONMENT_KDE4: 445 case base::DESKTOP_ENVIRONMENT_KDE4:
446 command.argv = kKDE4ProxyConfigCommand; 446 command.argv = kKDE4ProxyConfigCommand;
447 found_command = SearchPATH(&command, 1, NULL); 447 found_command = SearchPATH(&command, 1, NULL);
448 break; 448 break;
449 449
450 case base::DESKTOP_ENVIRONMENT_XFCE: 450 case base::DESKTOP_ENVIRONMENT_XFCE:
451 case base::DESKTOP_ENVIRONMENT_OTHER: 451 case base::DESKTOP_ENVIRONMENT_OTHER:
452 break; 452 break;
453 } 453 }
454 454
455 if (found_command) { 455 if (found_command) {
456 StartProxyConfigUtil(command); 456 StartProxyConfigUtil(command);
457 } else { 457 } else {
458 const char* name = base::GetDesktopEnvironmentName(env_getter.get()); 458 const char* name = base::GetDesktopEnvironmentName(env.get());
459 if (name) 459 if (name)
460 LOG(ERROR) << "Could not find " << name << " network settings in $PATH"; 460 LOG(ERROR) << "Could not find " << name << " network settings in $PATH";
461 BrowserList::GetLastActive()-> 461 BrowserList::GetLastActive()->
462 OpenURL(GURL(kLinuxProxyConfigUrl), 462 OpenURL(GURL(kLinuxProxyConfigUrl),
463 GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); 463 GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
464 } 464 }
465 } 465 }
466 466
467 // static 467 // static
468 bool NetworkSection::SearchPATH(ProxyConfigCommand* commands, size_t ncommands, 468 bool NetworkSection::SearchPATH(ProxyConfigCommand* commands, size_t ncommands,
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT), 1254 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT),
1255 web_content_section_->get_page_widget(), false); 1255 web_content_section_->get_page_widget(), false);
1256 1256
1257 security_section_.reset(new SecuritySection(profile_)); 1257 security_section_.reset(new SecuritySection(profile_));
1258 options_builder->AddOptionGroup( 1258 options_builder->AddOptionGroup(
1259 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY), 1259 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY),
1260 security_section_->get_page_widget(), false); 1260 security_section_->get_page_widget(), false);
1261 1261
1262 page_ = options_builder->get_page_widget(); 1262 page_ = options_builder->get_page_widget();
1263 } 1263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698